我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用wx.ID_ABOUT。
def wxPythonApp(): import wx app = wx.App() frame = wx.Frame(None, -1, "wxPython GUI", size=(200,150)) frame.SetBackgroundColour('white') frame.CreateStatusBar() menu= wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menuBar = wx.MenuBar() menuBar.Append(menu,"File") frame.SetMenuBar(menuBar) frame.Show() runT = Thread(target=app.MainLoop) runT.setDaemon(True) runT.start() print(runT) print('createThread():', runT.isAlive())
def _build_menu_bar(self): self.menuBar = wx.MenuBar() # File menu file_menu = wx.Menu() wx.App.SetMacExitMenuItemId(wx.ID_EXIT) exit_item = file_menu.Append(wx.ID_EXIT, "E&xit\tCtrl-Q", "Exit NodeMCU PyFlasher") exit_item.SetBitmap(images.Exit.GetBitmap()) self.Bind(wx.EVT_MENU, self._on_exit_app, exit_item) self.menuBar.Append(file_menu, "&File") # Help menu help_menu = wx.Menu() help_item = help_menu.Append(wx.ID_ABOUT, '&About NodeMCU PyFlasher', 'About') self.Bind(wx.EVT_MENU, self._on_help_about, help_item) self.menuBar.Append(help_menu, '&Help') self.SetMenuBar(self.menuBar)
def __init__(self, parent): wx.Panel.__init__(self, parent) imageFile = 'Tile.bmp' self.bmp = wx.Bitmap(imageFile) # react to a resize event and redraw image parent.Bind(wx.EVT_SIZE, self.canvasCallback) menu = wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menu.AppendSeparator() menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE) button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100)) self.Bind(wx.EVT_BUTTON, self.buttonCallback, button) parent.CreateStatusBar()
def __init__(self, parent): wx.Panel.__init__(self, parent) menu = wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menu.AppendSeparator() menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE) button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100)) self.Bind(wx.EVT_BUTTON, self.buttonCallback, button) parent.CreateStatusBar()
def _build_menu(self): """Build the application menu.""" menubar = wx.MenuBar() file_menu = wx.Menu() help_menu = wx.Menu() self.Bind(wx.EVT_MENU, self._directory_chooser, file_menu.Append(wx.ID_OPEN, 'Open directory...')) self.Bind(wx.EVT_MENU, self._open_settings, file_menu.Append(wx.ID_PROPERTIES, 'Settings...')) file_menu.AppendSeparator() self.Bind(wx.EVT_MENU, lambda evt: self.Close(), file_menu.Append(wx.ID_EXIT)) self.Bind(wx.EVT_MENU, self._open_about, help_menu.Append(wx.ID_ABOUT)) self.Bind(wx.EVT_MENU, lambda evt: wx.LaunchDefaultBrowser("http://irida-miseq-uploader.readthedocs.io/en/latest/"), help_menu.Append(wx.ID_HELP)) menubar.Append(file_menu, '&File') menubar.Append(help_menu, '&Help') self.SetMenuBar(menubar)
def _init_coll_HelpMenu_Items(self, parent): AppendMenu(parent, help='', id=wx.ID_HELP, kind=wx.ITEM_NORMAL, text=_(u'PLCOpenEditor') + '\tF1') # AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS, # kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2') # AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT, # kind=wx.ITEM_NORMAL, text=u'IEC 61131-3\tF3') def handler(event): return wx.MessageBox( version.GetCommunityHelpMsg(), _(u'Community support'), wx.OK | wx.ICON_INFORMATION) id = wx.NewId() parent.Append(help='', id=id, kind=wx.ITEM_NORMAL, text=_(u'Community support')) self.Bind(wx.EVT_MENU, handler, id=id) AppendMenu(parent, help='', id=wx.ID_ABOUT, kind=wx.ITEM_NORMAL, text=_(u'About')) self.Bind(wx.EVT_MENU, self.OnPLCOpenEditorMenu, id=wx.ID_HELP) # self.Bind(wx.EVT_MENU, self.OnPLCOpenMenu, id=wx.ID_HELP_CONTENTS) self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
def wxPythonApp(): import wx app = wx.App() frame = wx.Frame(None, -1, "wxPython GUI", size=(200,150)) frame.SetBackgroundColour('white') frame.CreateStatusBar() menu= wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menuBar = wx.MenuBar() menuBar.Append(menu,"File") frame.SetMenuBar(menuBar) frame.Show() app.MainLoop()
def createMenu(self): menu= wx.Menu() menu.Append(wx.ID_NEW, "New", "Create something new") menu.AppendSeparator() _exit = menu.Append(wx.ID_EXIT, "Exit", "Exit the GUI") self.Bind(wx.EVT_MENU, self.exitGUI, _exit) menuBar = wx.MenuBar() menuBar.Append(menu, "File") menu1= wx.Menu() menu1.Append(wx.ID_ABOUT, "About", "wxPython GUI") menuBar.Append(menu1, "Help") self.SetMenuBar(menuBar) #----------------------------------------------------------
def __init__(self, parent): wx.Panel.__init__(self, parent) parent.CreateStatusBar() menu= wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) button = wx.Button(self, label="Print", pos=(0,60)) self.Bind(wx.EVT_BUTTON, self.writeToSharedQueue, button) self.textBox = wx.TextCtrl(self, size=(280,50), style=wx.TE_MULTILINE) #-----------------------------------------------------------------
def wxPythonApp(): import wx app = wx.App() frame = wx.Frame(None, -1, "wxPython GUI", size=(200,150)) frame.SetBackgroundColour('white') frame.CreateStatusBar() menu= wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") frame.SetMenuBar(menuBar) frame.Show() app.MainLoop()
def CreateMenuBar(self): menubar = wx.MenuBar() fileMenu = wx.Menu() nitem = fileMenu.Append(wx.ID_NEW, '&New', 'New project' ) oitem = fileMenu.Append(wx.ID_OPEN, '&Open', 'Open project') self.ritem = fileMenu.Append(wx.ID_SAVEAS, '&Render\tCtrl-r', 'Render') self.iitem = fileMenu.Append(wx.ID_ANY, '&Import\tCtrl-i', 'Import image directory') self.qitem = fileMenu.Append(wx.ID_EXIT, '&Quit', 'Quit application') editMenu = wx.Menu() self.zitem = editMenu.Append(wx.ID_UNDO, '&Undo\tCtrl-z', 'Undo Delete') #yitem = editMenu.Append(wx.ID_REDO, '&Redo', 'Redo') self.ditem = editMenu.Append(wx.ID_DELETE, '&Delete\tDelete', 'Delete') pitem = editMenu.Append(wx.ID_PREFERENCES, '&Preferences\tCtrl-,', 'Preferences') helpMenu = wx.Menu() aitem = helpMenu.Append(wx.ID_ABOUT, '&About\tCtrl-?', 'About Stopgo') menubar.Append(fileMenu, '&File') menubar.Append(editMenu, '&Edit') menubar.Append(helpMenu, '&Help') self.Bind(wx.EVT_MENU, lambda event, args=(False): self.OpenFile(event,args), oitem) self.Bind(wx.EVT_MENU, self.NewFile, nitem) self.Bind(wx.EVT_MENU, self.Pref, pitem) self.Bind(wx.EVT_MENU, lambda event,args=(False): ingest.Ingest(self),self.iitem) self.Bind(wx.EVT_MENU, self.SimpleQuit, self.qitem) self.Bind(wx.EVT_CLOSE, self.SimpleQuit, self.qitem) self.Bind(wx.EVT_MENU, self.About, aitem) self.SetMenuBar(menubar)
def __init__(self, parent, title): self.dirname=os.getcwd() wx.Frame.__init__(self, parent, title=title, size=(1000,700)) self.SetSizeHints(1000,700,-1,-1) self.CreateStatusBar() filemenu= wx.Menu() menuOpen = filemenu.Append(wx.ID_OPEN, "&Open"," Open saved state") menuSave = filemenu.Append(wx.ID_SAVE, "&Save"," Save current state") filemenu.InsertSeparator(2) menuNew = filemenu.Append(wx.ID_NEW, "&New"," Create new session") filemenu.InsertSeparator(4) menuExit = filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program") viewmenu = wx.Menu() vismenu = wx.Menu() self.viewmenuundock = vismenu.Append(wx.ID_ANY,"&Undock","Undock the visualisation") self.viewmenuundock.Enable(0) self.viewmenudock = vismenu.Append(wx.ID_ANY,"&Dock","Dock the visualisation") self.viewmenudock.Enable(0) self.Bind(wx.EVT_MENU, self.OnUndock, self.viewmenuundock) self.Bind(wx.EVT_MENU, self.OnDock, self.viewmenudock) if IsNotWX4(): viewmenu.AppendMenu(wx.ID_ANY,"&Visualisation", vismenu) else: viewmenu.Append(wx.ID_ANY,"&Visualisation", vismenu) self.visualdialog_docked = True editmenu = wx.Menu() self.menuCWD = editmenu.Append(wx.ID_ANY, "Current Working &Directory","Current Working Directory") self.Bind(wx.EVT_MENU, self.OnCWD, self.menuCWD) helpmenu= wx.Menu() menuAbout= helpmenu.Append(wx.ID_ABOUT, "&About"," Information about Bonsu") menuDoc= helpmenu.Append(wx.ID_HELP, "&Contents","Documentation") menuBar = wx.MenuBar() menuBar.Append(filemenu,"&File") menuBar.Append(viewmenu,"&View") menuBar.Append(editmenu,"&Edit") menuBar.Append(helpmenu,"&Help") self.SetMenuBar(menuBar) self.Bind(wx.EVT_MENU, self.OnOpen, menuOpen) self.Bind(wx.EVT_MENU, self.OnSave, menuSave) self.Bind(wx.EVT_MENU, self.OnNew, menuNew) self.Bind(wx.EVT_MENU, self.OnExit, menuExit) self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout) self.Bind(wx.EVT_MENU, self.OnHelp, menuDoc) self.Bind(wx.EVT_CLOSE, self.OnExit) self.fontpointsize=wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPointSize() self.font = wx.Font(self.fontpointsize, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) self.SetFont(self.font) icon = wx.Icon(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'image', 'bonsu.ico'), wx.BITMAP_TYPE_ICO) wx.Frame.SetIcon(self, icon) self.nb = None self.sizer = wx.BoxSizer(wx.VERTICAL) self.Fit() self.Layout() self.Show()
def __init__(self, parent, title): (self.display_length_, self.display_height_) = wx.GetDisplaySize() self.frame_width_ = self.display_length_ * 90 / 100 self.frame_height_ = self.display_height_ * 90 / 100 self.answer_panel_width_ = self.frame_width_ * 15 / 100 super(MainFrame, self).__init__(parent=parent, title=title, size=(self.frame_width_, self.frame_height_)) self.splitter = wx.SplitterWindow(parent=self, style=wx.SP_LIVE_UPDATE) self.splitter.SetMinimumPaneSize(min=100) self.web_panel = WebPanel(parent=self.splitter) self.answer_panel = wx.Panel(parent=self.splitter) self.answers_box = wx.BoxSizer(orient=wx.VERTICAL) self.answers_box.Add(item=self.answer_panel) self.splitter.SplitVertically(window1=self.answer_panel, window2=self.web_panel, sashPosition=self.answer_panel_width_) self.Sizer = wx.BoxSizer(orient=wx.VERTICAL) self.Sizer.Add(item=self.splitter, proportion=CAN_CHANGE, flag=wx.EXPAND) auto_answer_button = wx.Button(parent=self, label=u"????") self.Bind(event=wx.EVT_BUTTON, handler=self.click_search_answer, source=auto_answer_button) self.buttons_box = wx.BoxSizer(orient=wx.HORIZONTAL) self.buttons_box.Add(item=auto_answer_button, proportion=CAN_NOT_CHANGE, flag=wx.LEFT | wx.RIGHT, border=5) self.Sizer.Add(item=self.buttons_box, proportion=CAN_NOT_CHANGE, flag=wx.TOP | wx.BOTTOM, border=5) menu = wx.Menu() menu_about = menu.Append(id=wx.ID_ABOUT, text=u"&??", help=u" ?????") menu_feedback = menu.Append(id=wx.ID_OPEN, text=u"&??", help=u" ??") self.Bind(event=wx.EVT_MENU, handler=self.show_about, source=menu_about) self.Bind(event=wx.EVT_MENU, handler=self.show_feedback, source=menu_feedback) menu_bar = wx.MenuBar() menu_bar.Append(menu, u"&??") self.SetMenuBar(menu_bar) self.statusbar = self.CreateStatusBar() self.Centre()
def __init__(self, parent, info): title = _("About") + " " + info.Name wx.Dialog.__init__(self, parent, title=title) self.info = info if parent and parent.GetIcon(): self.SetIcon(parent.GetIcon()) image = None if self.info.Icon: bitmap = wx.BitmapFromIcon(self.info.Icon) image = wx.StaticBitmap(self, bitmap=bitmap) name = wx.StaticText(self, label="%s %s" % (info.Name, info.Version)) description = wx.StaticText(self, label=info.Description) description.Wrap(400) copyright = wx.StaticText(self, label=info.Copyright) url = HyperLinkCtrl(self, label=info.WebSite[0], URL=info.WebSite[1]) font = name.GetClassDefaultAttributes().font font.SetWeight(wx.FONTWEIGHT_BOLD) font.SetPointSize(18) name.SetFont(font) credits = wx.Button(self, id=wx.ID_ABOUT, label=_("C&redits")) license = wx.Button(self, label=_("&License")) close = wx.Button(self, id=wx.ID_CANCEL, label=_("&Close")) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(credits, flag=wx.CENTER | wx.LEFT | wx.RIGHT, border=5) btnSizer.Add(license, flag=wx.CENTER | wx.RIGHT, border=5) btnSizer.Add(close, flag=wx.CENTER | wx.RIGHT, border=5) sizer = wx.BoxSizer(wx.VERTICAL) if image: sizer.Add(image, flag=wx.CENTER | wx.TOP | wx.BOTTOM, border=5) sizer.Add(name, flag=wx.CENTER | wx.BOTTOM, border=10) sizer.Add(description, flag=wx.CENTER | wx.BOTTOM, border=10) sizer.Add(copyright, flag=wx.CENTER | wx.BOTTOM, border=10) sizer.Add(url, flag=wx.CENTER | wx.BOTTOM, border=15) sizer.Add(btnSizer, flag=wx.CENTER | wx.BOTTOM, border=5) container = wx.BoxSizer(wx.VERTICAL) container.Add(sizer, flag=wx.ALL, border=10) self.SetSizer(container) self.Layout() self.Fit() self.Centre() self.Show(True) self.SetEscapeId(close.GetId()) credits.Bind(wx.EVT_BUTTON, self.on_credits) license.Bind(wx.EVT_BUTTON, self.on_license) close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy())