def __init__(self, parent, ID, title): wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, wxSize(300, 200)) menu = wxMenu() menu.Append(ID_DIALOG, "D&ialog", "Show dialog") menu.Append(ID_EXIT, "E&xit", "Terminate the program") menuBar = wxMenuBar() menuBar.Append(menu, "&File") self.SetMenuBar(menuBar) EVT_MENU(self, ID_EXIT, self.DoExit) EVT_MENU(self, ID_DIALOG, self.DoDialog)
def __init__(self, parent, ID, title): Frame.__init__(self, parent, ID, title, DefaultPosition, Size(300, 200)) menu = Menu() menu.Append(ID_EXIT, "E&xit", "Terminate the program") menuBar = MenuBar() menuBar.Append(menu, "&File") self.SetMenuBar(menuBar) EVT_MENU(self, ID_EXIT, self.DoExit) # make sure reactor.stop() is used to stop event loop: EVT_CLOSE(self, lambda evt: reactor.stop())