我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.MenuBar()。
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 OnInit(self): frame = wx.Frame(None, -1, "RunDemo: ", pos=(0,0), style=wx.DEFAULT_FRAME_STYLE, name="run a sample") menuBar = wx.MenuBar() menu = wx.Menu() item = menu.Append(wx.ID_EXIT, "E&xit", "Exit demo") self.Bind(wx.EVT_MENU, self.OnExitApp, item) menuBar.Append(menu, "&File") frame.SetMenuBar(menuBar) frame.Show(True) frame.Bind(wx.EVT_CLOSE, self.OnCloseFrame) win = runTest(frame) # set the frame to a good size for showing the two buttons frame.SetSize((200,400)) win.SetFocus() self.window = win frect = frame.GetRect() self.SetTopWindow(frame) self.frame = frame return True
def createMenus(self): # Creating the menubar. menuBar = wx.MenuBar() # Setting up the menu. filemenu = wx.Menu() filemenu.Append(ID_MENU_FILE_READ, "Read"," Read last numbers dialed SIM.") filemenu.AppendSeparator() filemenu.Append(ID_MENU_FILE_EXPORT, "Export..."," Export your LND to file") filemenu.Append(ID_MENU_FILE_IMPORT, "Import..."," Import your LND from file") filemenu.AppendSeparator() filemenu.Append(ID_MENU_FILE_EXIT, "Close"," Close the lnd") # Adding the "filemenu" to the MenuBar menuBar.Append(filemenu,"&File") # Adding the MenuBar to the Frame content. self.SetMenuBar(menuBar) #Add the menu handlers wx.EVT_MENU(self, ID_MENU_FILE_READ, self.read) wx.EVT_MENU(self, ID_MENU_FILE_EXPORT, self.doExport) wx.EVT_MENU(self, ID_MENU_FILE_IMPORT, self.doImport) wx.EVT_MENU(self, ID_MENU_FILE_EXIT, self.closeWindow)
def createMenus(self): # Creating the menubar. menuBar = wx.MenuBar() # Setting up the menu. filemenu = wx.Menu() filemenu.Append(ID_MENU_FILE_READ, "Read"," Read your phonebook contacts from your SIM.") filemenu.AppendSeparator() filemenu.Append(ID_MENU_FILE_EXPORT, "Export..."," Export your phone contacts to file") filemenu.Append(ID_MENU_FILE_IMPORT, "Import..."," Import your phone contacts from file") filemenu.AppendSeparator() filemenu.Append(ID_MENU_FILE_EXIT, "Close"," Close the phonebook") # Adding the "filemenu" to the MenuBar menuBar.Append(filemenu,"&File") # Adding the MenuBar to the Frame content. self.SetMenuBar(menuBar) #Add the menu handlers wx.EVT_MENU(self, ID_MENU_FILE_READ, self.read) wx.EVT_MENU(self, ID_MENU_FILE_EXPORT, self.doExport) wx.EVT_MENU(self, ID_MENU_FILE_IMPORT, self.doImport) wx.EVT_MENU(self, ID_MENU_FILE_EXIT, self.closeWindow)
def createMenus(self): # Creating the menubar. menuBar = wx.MenuBar() # Setting up the menu. filemenu = wx.Menu() filemenu.Append(ID_MENU_FILE_EXPORT, "Export..."," Export your SMS messages to file") filemenu.Append(ID_MENU_FILE_IMPORT, "Import..."," Import your SMS messages from file") filemenu.AppendSeparator() filemenu.Append(ID_MENU_FILE_EXIT, "Close"," Close this window") # Adding the "filemenu" to the MenuBar menuBar.Append(filemenu,"&File") # Adding the MenuBar to the Frame content. self.SetMenuBar(menuBar) #Add the menu handlers wx.EVT_MENU(self, ID_MENU_FILE_EXPORT, self.doExport) wx.EVT_MENU(self, ID_MENU_FILE_IMPORT, self.doImport) wx.EVT_MENU(self, ID_MENU_FILE_EXIT, self.closeWindow)
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 buildMenuBar(parent, datas, menuBar=None): # datas:tuple # datas[1]: list # datas[1][-1]: tuple # datas[1][-1][-1]: list if menuBar==None: menuBar = wx.MenuBar() for data in datas[1]: if len(data[1]) == 0: continue LanguageManager.add(data[0].title) menuBar.Append(buildMenu(parent, data, data[0].title), LanguageManager.get(data[0].title)) return menuBar #!ToDO: tongguo lujing goujian menu
def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, "Panel Switcher Tutorial") self.panel_one = PanelOne(self) self.panel_two = PanelTwo(self) self.panel_two.Hide() self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.panel_one, 1, wx.EXPAND) self.sizer.Add(self.panel_two, 1, wx.EXPAND) self.SetSizer(self.sizer) menubar = wx.MenuBar() fileMenu = wx.Menu() switch_panels_menu_item = fileMenu.Append( wx.ID_ANY, "Switch Panels", "Some text") self.Bind(wx.EVT_MENU, self.onSwitchPanels, switch_panels_menu_item) menubar.Append(fileMenu, '&File') self.SetMenuBar(menubar)
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() for eachMenuData in self.menuData(): menuLabel = eachMenuData[0] menuItems = eachMenuData[1:] menuBar.Append(self.createMenu(menuItems), menuLabel) self.SetMenuBar(menuBar)
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, title, pos, size): self.threads = [] self.getsession = [] self.MAC='' self.IP='' wx.Frame.__init__(self, None, -1, title, pos, size) menuFile = wx.Menu() menuFile.Append(1, u"&??...",u"?????") menuFile.Append(3,u"&????",u"?????IP") menuFile.AppendSeparator() menuFile.Append(2,u"&Bug Report",u"???????bug?") menuBar = wx.MenuBar() menuBar.Append(menuFile, u"&??") self.SetMenuBar(menuBar) self.Bind(wx.EVT_MENU, self.OnAbout,id=1) self.Bind(wx.EVT_MENU,self.OnBugReport,id=2) hosts = self.Bind(wx.EVT_MENU,self.OnSet,id=3) self.CreateStatusBar() self.SetStatusText(u"????") panel = wx.Panel(self) self.connect = wx.Button(panel,label=u"??",pos=(240, 60),size=(80, 50)) self.disconnect = wx.Button(panel,label=u"??",pos=(330,60),size=(80,50)) self.connect.Disable() self.disconnect.Disable() self.Bind(wx.EVT_BUTTON, self.OnDisconnect,self.disconnect) self.Bind(wx.EVT_BUTTON,self.OnConnect,self.connect) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) wx.StaticText(panel, -1, u"???:", pos=(28, 40)) self.username = wx.TextCtrl(panel, -1 ,pos=(80, 40)) self.username.SetInsertionPoint(0) self.Bind(wx.EVT_TEXT,self.Onuser,self.username) wx.StaticText(panel,-1,u"??:",pos=(242,40)) self.pwd = wx.TextCtrl(panel, -1,pos=(280,40),style=wx.TE_PASSWORD |wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_TEXT,self.Onpwd,self.pwd) wx.CheckBox(panel, -1, u"????", (20, 80), (150, 20)) wx.CheckBox(panel, -1, u"????", (110, 80), (150, 20))
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, size=(550, 350)) self.SetBackgroundColour(wx.NamedColour("WHITE")) self.figure = Figure() self.axes = self.figure.add_subplot(111) self.change_plot(0) self.canvas = FigureCanvas(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.add_buttonbar() self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.add_toolbar() # comment this out for no toolbar menuBar = wx.MenuBar() # File Menu menu = wx.Menu() menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample") menuBar.Append(menu, "&File") if IS_GTK or IS_WIN: # Equation Menu menu = wx.Menu() for i, (mt, func) in enumerate(functions): bm = mathtext_to_wxbitmap(mt) item = wx.MenuItem(menu, 1000 + i, "") item.SetBitmap(bm) menu.AppendItem(item) self.Bind(wx.EVT_MENU, self.OnChangePlot, item) menuBar.Append(menu, "&Functions") self.SetMenuBar(menuBar) self.SetSizer(self.sizer) self.Fit()
def _init_utils(self): self.MenuBar = wx.MenuBar() self.FileMenu = wx.Menu(title='') self.EditMenu = wx.Menu(title='') self.DisplayMenu = wx.Menu(title='') self.HelpMenu = wx.Menu(title='') self._init_coll_MenuBar_Menus(self.MenuBar) self._init_coll_FileMenu_Items(self.FileMenu) self._init_coll_EditMenu_Items(self.EditMenu) self._init_coll_DisplayMenu_Items(self.DisplayMenu) self._init_coll_HelpMenu_Items(self.HelpMenu)
def __init__(self, parent, title, data, cols=None, rows=None): wx.Frame.__init__(self, parent, -1, title) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) TableLogManager.add(title, self) self.data, self.cols, self.rows = data, cols, rows tableBase = GenericTable(data, cols, rows) self.grid = wx.grid.Grid(self) ## create tablegrid and set tablegrid value #self.grid.SetTable(tableBase) self.Bind(wx.EVT_CLOSE, self.OnClose) self.grid.CreateGrid(len(data), len(data[0])) if cols!=None: for i in range(len(cols)): self.grid.SetColLabelValue(i, cols[i]) if rows!=None: for i in range(len(rows)): self.grid.SetColLabelValue(i, rows[i]) for i in range(len(data)): for j in range(len(data[0])): self.grid.SetCellValue(i, j,str(data[i][j])) self.grid.AutoSize() ## create menus menus = [('File(&F)', [('Save as tab', self.OnSaveTab), ('Save as csv', self.OnSaveCsv), ('-'), ('Exit', self.OnClose) ] ), ('Help(&H)', [('About', self.OnAbout)] ) ] ## bind the menus with the correspond events menuBar=wx.MenuBar() for menu in menus: m = wx.Menu() for item in menu[1]: if item[0]=='-': m.AppendSeparator() else: i = m.Append(-1, item[0]) if item[1]!=None: self.Bind(wx.EVT_MENU,item[1], i) menuBar.Append(m,menu[0]) self.SetMenuBar(menuBar) self.Fit()
def __init__(self, title='ImagePy TexLog'): wx.Frame.__init__(self, IPy.curapp,title=title,size=(500,300)) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.title = title TextLogManager.add(title, self) self.file='' ### Create menus (name:event) k-v pairs menus = [ ## File ('File(&F)',[('Open', self.OnOpen), ('Save', self.OnSave), ('Save as', self.OnSaveAs), ('-'), ('Exit', self.OnClose) ]), ## Edit ('Edit(&E)', [ ('Undo', self.OnUndo), ('Redo', self.OnRedo), ('-'), ('Cut', self.OnCut), ('Copy', self.OnCopy), ('Paste', self.OnPaste), ('-'), ('All', self.OnSelectAll) ]), ## Help ('Help(&H)', [('About', self.OnAbout)]) ] ### Bind menus with the corresponding events self.menuBar=wx.MenuBar() for menu in menus: m = wx.Menu() for item in menu[1]: if item[0]=='-': m.AppendSeparator() else: i = m.Append(-1, item[0]) self.Bind(wx.EVT_MENU,item[1], i) self.menuBar.Append(m,menu[0]) self.SetMenuBar(self.menuBar) self.Bind(wx.EVT_CLOSE, self.OnClosing) sizer = wx.BoxSizer( wx.VERTICAL ) self.text= wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE ) sizer.Add( self.text, 1, wx.ALL|wx.EXPAND, 1 ) self.SetSizer( sizer ) self.Bind(wx.EVT_RIGHT_DOWN,self.OnRClick)
def __init__( self ): wx.Frame.__init__( self, None, wx.ID_ANY, style=wx.DEFAULT_FRAME_STYLE, name="MWScore Server" ) # MWScore ScoreServer. self.ScoreServer = MWScore.ScoreServer() # Menu Bar self.MenuBar = wx.MenuBar() self.FileMenu = wx.Menu() self.TransponderMenu = wx.Menu() self.SocketMenu = wx.Menu() self.MatchMenu = wx.Menu() self.FileMenu.Append( self.ID_QUIT, "Quit" ) self.Bind( wx.EVT_MENU, self.Quit, id=self.ID_QUIT ) self.TransponderMenu.Append( self.ID_TRANSPONDERSETUP, "Setup" ) self.Bind( wx.EVT_MENU, self.TransponderSetup, id=self.ID_TRANSPONDERSETUP ) self.SocketMenu.Append( self.ID_SOCKETSETUP, "Setup" ) self.Bind( wx.EVT_MENU, self.SocketSetup, id=self.ID_SOCKETSETUP ) self.MatchMenu.Append( self.ID_MATCHSETUP, "Setup" ) self.MatchMenu.Append( self.ID_MATCHSTART, "Start/Resume" ) self.MatchMenu.Append(self.ID_MATCHPAUSE, "Pause" ) self.MatchMenu.Append(self.ID_MATCHRESET, "Reset" ) self.MatchMenu.Append(self.ID_MATCHRESETHP, "Reset HP" ) self.Bind( wx.EVT_MENU, self.MatchSetup, id=self.ID_MATCHSETUP ) self.Bind( wx.EVT_MENU, self.MatchStart, id=self.ID_MATCHSTART ) self.Bind( wx.EVT_MENU, self.MatchPause, id=self.ID_MATCHPAUSE ) self.Bind( wx.EVT_MENU, self.MatchReset, id=self.ID_MATCHRESET ) self.Bind( wx.EVT_MENU, self.MatchResetHP, id=self.ID_MATCHRESETHP ) self.MenuBar.Append( self.FileMenu, "&File" ) self.MenuBar.Append( self.MatchMenu, "&Match" ) self.MenuBar.Append( self.TransponderMenu, "&Transponder" ) self.MenuBar.Append( self.SocketMenu, "&Socket" ) self.SetMenuBar( self.MenuBar ) # Panel self.Panel = MatchPanel( self, -1 ) # Frame Update Timer self.Timer = wx.Timer( self, self.FRAME_UPDATE_TIMER_ID ) self.Timer.Start(100) wx.EVT_TIMER( self, self.FRAME_UPDATE_TIMER_ID, self.OnTimer ) self.Show( True ) self.SetTitle("Mech Warfare Match Score") # Updates the frames panel and Broadcasts match data to clients
def setup(self): menubar = wx.MenuBar() filem = wx.Menu() helpm = wx.Menu() setm = wx.Menu() new = filem.Append(wx.ID_NEW, '&New Tournament') open_ = filem.Append(wx.ID_OPEN, '&Open Tournament') filem.AppendSeparator() self.Bind(wx.EVT_MENU, self.new_event, new) qmi = wx.MenuItem(filem, wx.ID_EXIT, '&Quit\tCtrl+W') filem.AppendItem(qmi) about = helpm.Append(wx.ID_ANY, '&About BP5000') options = setm.Append(wx.ID_ANY, '&Options') self.Bind(wx.EVT_MENU, self.quit_event, qmi) self.Bind(wx.EVT_MENU, self.load_event, open_) self.Bind(wx.EVT_MENU, self.about_event, about) self.Bind(wx.EVT_MENU, self.options_event, options) self.options = Options() menubar.Append(filem, '&File') menubar.Append(setm, '&Settings') menubar.Append(helpm, '&Help') self.SetMenuBar(menubar) p = wx.Panel(self) self.nb = fnb.FlatNotebook(p, agwStyle=fnb.FNB_X_ON_TAB) def pagechanged(event): col = wx.Colour(hash(self.nb.GetPage(event.GetSelection()).sname)) self.nb.SetActiveTabColour(col) if isinstance(self.nb.GetPage(event.GetSelection()), BracketPage): self.nb.GetPage(event.GetSelection()).updatebracketimg() self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, pagechanged) sz = wx.BoxSizer() sz.Add(self.nb, 1, wx.EXPAND) p.SetSizer(sz) self.Bind(wx.EVT_CLOSE, self.quit_event) self.SetSize((950, 650)) self.SetTitle('BP5000') self.Centre() self.Show(True)
def _create_menu(self): """ Creates a menu """ menubar = wx.MenuBar() trainingMenu = wx.Menu() srMenu = wx.Menu() #settMenu = wx.Menu() testsMenu = wx.Menu() self.training_rec_menu_item = trainingMenu.Append(wx.NewId(), "&New", "New") self.max_time_menu_item = trainingMenu.Append(wx.NewId(), "&Edit max time", "Edit max time") self.start_rec_menu_item = srMenu.Append(wx.NewId(), "&Start", "Start") self.partial_time_menu_item = srMenu.Append(wx.NewId(), "&Edit partial time", "Edit partial time") self.sett1 = testsMenu.Append(wx.NewId(), "&Incremental", "Incremental",kind=wx.ITEM_RADIO ) self.sett2 = testsMenu.Append(wx.NewId(), "&Fixed", "Fixed",kind=wx.ITEM_RADIO ) self.sett3 = testsMenu.Append(wx.NewId(), "&One shot", "One shot",kind=wx.ITEM_RADIO ) self.sett2.Enable(True) self.sett3.Enable(True) testsMenu.Check(self.sett1.GetId(), True) testsMenu.Check(self.sett2.GetId(), False) menubar.Append(trainingMenu, '&Training') menubar.Append(srMenu, '&Test') menubar.Append(testsMenu, '&Settings') #menubar.Append(settMenu, '&Settings') self.SetMenuBar(menubar)
def __init__(self, *args, **kwds): self.serial = serial.Serial() self.serial.timeout = 0.5 # make sure that the alive event can be checked from time to time self.settings = TerminalSetup() # placeholder for the settings self.thread = None self.alive = threading.Event() # begin wxGlade: TerminalFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # Menu Bar self.frame_terminal_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(ID_CLEAR, "&Clear", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_SAVEAS, "&Save Text As...", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_TERM, "&Terminal Settings...", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_EXIT, "&Exit", "", wx.ITEM_NORMAL) self.frame_terminal_menubar.Append(wxglade_tmp_menu, "&File") wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(ID_RTS, "RTS", "", wx.ITEM_CHECK) wxglade_tmp_menu.Append(ID_DTR, "&DTR", "", wx.ITEM_CHECK) wxglade_tmp_menu.Append(ID_SETTINGS, "&Port Settings...", "", wx.ITEM_NORMAL) self.frame_terminal_menubar.Append(wxglade_tmp_menu, "Serial Port") self.SetMenuBar(self.frame_terminal_menubar) # Menu Bar end self.text_ctrl_output = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE | wx.TE_READONLY) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_MENU, self.OnClear, id=ID_CLEAR) self.Bind(wx.EVT_MENU, self.OnSaveAs, id=ID_SAVEAS) self.Bind(wx.EVT_MENU, self.OnTermSettings, id=ID_TERM) self.Bind(wx.EVT_MENU, self.OnExit, id=ID_EXIT) self.Bind(wx.EVT_MENU, self.OnRTS, id=ID_RTS) self.Bind(wx.EVT_MENU, self.OnDTR, id=ID_DTR) self.Bind(wx.EVT_MENU, self.OnPortSettings, id=ID_SETTINGS) # end wxGlade self.__attach_events() # register events self.OnPortSettings(None) # call setup dialog on startup, opens port if not self.alive.isSet(): self.Close()
def __init__(self, *args, **kwds): self.serial = serial.Serial() self.serial.timeout = 0.5 #make sure that the alive event can be checked from time to time self.settings = TerminalSetup() #placeholder for the settings self.thread = None self.alive = threading.Event() # begin wxGlade: TerminalFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.text_ctrl_output = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY) # Menu Bar self.frame_terminal_menubar = wx.MenuBar() self.SetMenuBar(self.frame_terminal_menubar) wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(ID_CLEAR, "&Clear", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_SAVEAS, "&Save Text As...", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_SETTINGS, "&Port Settings...", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_TERM, "&Terminal Settings...", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_EXIT, "&Exit", "", wx.ITEM_NORMAL) self.frame_terminal_menubar.Append(wxglade_tmp_menu, "&File") # Menu Bar end self.__set_properties() self.__do_layout() # end wxGlade self.__attach_events() #register events self.OnPortSettings(None) #call setup dialog on startup, opens port if not self.alive.isSet(): self.Close()
def _create_menu(self): menubar = wx.MenuBar() file = wx.Menu() edit = wx.Menu() help = wx.Menu() file.Append(wx.ID_OPEN, '&Open', 'Open a schematic') file.Append(wx.ID_SAVE, '&Save', 'Save the schematic') file.AppendSeparator() file.Append(103, '&Export BOM as CSV', 'Export the BOM as CSV') file.AppendSeparator() # Create a new submenu for recent files recent = wx.Menu() file.AppendSubMenu(recent, 'Recent') self.filehistory.UseMenu(recent) self.filehistory.AddFilesToMenu() file.AppendSeparator() quit = wx.MenuItem(file, 105, '&Quit\tCtrl+Q', 'Quit the Application') file.AppendItem(quit) edit.Append(201, 'Consolidate Components', 'Consolidate duplicated components') menubar.Append(file, '&File') menubar.Append(edit, '&Edit') menubar.Append(help, '&Help') self.SetMenuBar(menubar) self.Bind(wx.EVT_MENU, self.on_quit, id=105) self.Bind(wx.EVT_MENU, self.on_open, id=wx.ID_OPEN) self.Bind(wx.EVT_MENU, self.on_consolidate, id=201) self.Bind(wx.EVT_MENU, self.on_export, id=103) self.Bind(wx.EVT_MENU, self.on_save, id=wx.ID_SAVE) self.Bind(wx.EVT_MENU_RANGE, self.on_file_history, id=wx.ID_FILE1, id2=wx.ID_FILE9)
def create_menu(self): filemenu = wx.Menu() filemenu.Append(1, "Some option") filemenu.Append(2, "Another option") menubar = wx.MenuBar() menubar.Append(filemenu, "&File") self.SetMenuBar(menubar)
def createMenu(self): """ Create the application's menu """ menubar = wx.MenuBar() # Create the file menu fileMenu = wx.Menu() # Append the close item # Append takes an id, the text label, and a string # to display in the statusbar when the item is selected close_menu_item = fileMenu.Append(wx.NewId(), "&Close", "Closes the application") # Bind an event to the menu item self.Bind(wx.EVT_MENU, self.onClose, close_menu_item) # Add the fileMenu to the menu bar menubar.Append(fileMenu, "&File") # Create the help menu helpMenu = wx.Menu() about_menu_item = helpMenu.Append(wx.NewId(), "&About", "Opens the About Box") self.Bind(wx.EVT_MENU, self.onAboutDlg, about_menu_item) menubar.Append(helpMenu, "&Help") # Add the menu bar to the frame self.SetMenuBar(menubar)
def create_preorder(self): self.w = wx.MenuBar(self.style)
def create_preorder(self): if self.menu is None: self.menu = wx.Menu() if not isinstance(self.zparent, (TopLevelMenu,Menu)): raise TypeError('wize.Menu nests under wize.MenuBar,wize.PopupMenu and wize.Menu, not %s' % (type(self.zparent,))) if isinstance(self.zparent, MenuBar): self.zparent.w.Append(self.menu, self.label) self.w = self.menu # there's no way to Enable/Disable wx.MenuBar top-level menus?! else: self.w = self.zparent.menu.AppendSubMenu(self.menu, self.label, self.help)
def __init__(self, *args, **kwargs): self.filename = None super(LISImportFrame, self).__init__(*args, **kwargs) self.SetTitle('GRIPy LIS Loader') self.panel = wx.Panel(self) self.menu_bar = wx.MenuBar() file_menu = wx.Menu() file_menu.Append(wx.ID_OPEN, u"&Open LIS File") self.Bind(wx.EVT_MENU, self.on_open, id=wx.ID_OPEN) self.menu_bar.Append(file_menu, u"&File") self.SetMenuBar(self.menu_bar) self.status_bar = self.CreateStatusBar() self.model = None self.dvc = None self._OM = ObjectManager(self)
def __init__(self, controller_uid): UIViewBase.__init__(self, controller_uid) wx.MenuBar.__init__(self) UIM = UIManager() parent_uid = UIM._getparentuid(controller_uid) parent = UIM.get(parent_uid) parent.view.SetMenuBar(self) #class_full_name = str(self.__class__.__module__) + '.' + str(self.__class__.__name__) #log.debug('Successfully created View object from class: {}.'.format(class_full_name))
def __init__(self): global myWindow wx.Frame.__init__(self, None, -1, "MQTT Protocol Trace", size=(600, 400)) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OpenDetails) self.list = wx.ListCtrl(self, -1, style=wx.LC_REPORT) self.statusBar = self.CreateStatusBar() menubar = wx.MenuBar() menu1 = wx.Menu() clear = menu1.Append(wx.NewId(), "&Clear") self.Bind(wx.EVT_MENU, self.OnClear, clear) saveas = menu1.Append(wx.NewId(), "&Save as") self.Bind(wx.EVT_MENU, self.OnSaveAs, saveas) menubar.Append(menu1, "&File") self.SetMenuBar(menubar) for index, title in enumerate(cols): self.list.InsertColumn(index, title) self.list.SetColumnWidth(index, widths[index]) self.listitem = 0 listmix.ColumnSorterMixin.__init__(self, len(cols)) self.itemDataMap = {} myWindow = self self.thread = WorkerThread() self.thread.start()
def _init_utils(self): # generated method, don't edit self.menuFile = wx.Menu(title=u'') self.menuView = wx.Menu(title=u'') self.menuHelp = wx.Menu(title=u'') self.TMenuBar = wx.MenuBar() self._init_coll_menuFile_Items(self.menuFile) self._init_coll_menuView_Items(self.menuView) self._init_coll_menuHelp_Items(self.menuHelp) self._init_coll_TMenuBar_Menus(self.TMenuBar)
def __init__(self, app_logic, *args, **kwargs): kwargs.setdefault('title', "Simple test App") wx.Frame.__init__(self, *args, **kwargs) self.app_logic = app_logic # Build up the menu bar: menuBar = wx.MenuBar() fileMenu = wx.Menu() saveasMenuItem = fileMenu.Append(wx.ID_ANY, "&Save As", "Create a new file") self.Bind(wx.EVT_MENU, self.onSaveAs, saveasMenuItem ) openMenuItem = fileMenu.Append(wx.ID_ANY, "&Open", "Open an existing file" ) self.Bind(wx.EVT_MENU, self.onOpen, openMenuItem) closeMenuItem = fileMenu.Append(wx.ID_ANY, "&Close", "Close a file" ) self.Bind(wx.EVT_MENU, self.onClose, closeMenuItem) exitMenuItem = fileMenu.Append(wx.ID_EXIT, "Exit", "Exit the application") self.Bind(wx.EVT_MENU, self.onExit, exitMenuItem) menuBar.Append(fileMenu, "&File") helpMenu = wx.Menu() helpMenuItem = helpMenu.Append(wx.ID_HELP, "Help", "Get help") menuBar.Append(helpMenu, "&Help") self.SetMenuBar(menuBar) ## add just a single button: self.theButton = wx.Button(self, label="Push Me") self.theButton.Bind(wx.EVT_BUTTON, self.onButton) self.theButton.Bind(wx.EVT_RIGHT_DOWN, self.onRight)
def __init__(self, app_logic, *args, **kwargs): kwargs.setdefault('title', "Simple test App") wx.Frame.__init__(self, *args, **kwargs) self.app_logic = app_logic # put the Panel on the frame self.buttonPanel = ButtonPanel(self) # Build up the menu bar: menuBar = wx.MenuBar() fileMenu = wx.Menu() openMenuItem = fileMenu.Append(wx.ID_ANY, "&Open", "Open a file" ) self.Bind(wx.EVT_MENU, self.onOpen, openMenuItem) closeMenuItem = fileMenu.Append(wx.ID_ANY, "&Close", "Close a file" ) self.Bind(wx.EVT_MENU, self.onClose, closeMenuItem) exitMenuItem = fileMenu.Append(wx.ID_EXIT, "Exit", "Exit the application") self.Bind(wx.EVT_MENU, self.onExit, exitMenuItem) menuBar.Append(fileMenu, "&File") helpMenu = wx.Menu() helpMenuItem = helpMenu.Append(wx.ID_HELP, "Help", "Get help") menuBar.Append(helpMenu, "&Help") self.SetMenuBar(menuBar)
def __init__(self, app_logic, *args, **kwargs): kwargs.setdefault('title', "Simple test App") wx.Frame.__init__(self, *args, **kwargs) self.app_logic = app_logic # Add a panel so it looks correct on all platforms self.panel = wx.Panel(self, wx.ID_ANY) # Build up the menu bar: menuBar = wx.MenuBar() fileMenu = wx.Menu() saveasMenuItem = fileMenu.Append(wx.ID_ANY, "&Save As", "Create a new file") self.Bind(wx.EVT_MENU, self.onSaveAs, saveasMenuItem ) openMenuItem = fileMenu.Append(wx.ID_ANY, "&Open", "Open an existing file" ) self.Bind(wx.EVT_MENU, self.onOpen, openMenuItem) closeMenuItem = fileMenu.Append(wx.ID_ANY, "&Close", "Close a file" ) self.Bind(wx.EVT_MENU, self.onClose, closeMenuItem) exitMenuItem = fileMenu.Append(wx.ID_EXIT, "Exit", "Exit the application") self.Bind(wx.EVT_MENU, self.onExit, exitMenuItem) menuBar.Append(fileMenu, "&File") helpMenu = wx.Menu() helpMenuItem = helpMenu.Append(wx.ID_HELP, "Help", "Get help") menuBar.Append(helpMenu, "&Help") self.SetMenuBar(menuBar)
def __init__(self, app_logic, *args, **kwargs): kwargs.setdefault('title', "Simple test App") wx.Frame.__init__(self, *args, **kwargs) self.app_logic = app_logic # Add a panel so it looks the correct on all platforms self.panel = wx.Panel(self, wx.ID_ANY) # Build up the menu bar: menuBar = wx.MenuBar() fileMenu = wx.Menu() openMenuItem = fileMenu.Append(wx.ID_ANY, "&Open", "Open a file" ) self.Bind(wx.EVT_MENU, self.onOpen, openMenuItem) closeMenuItem = fileMenu.Append(wx.ID_ANY, "&Close", "Close a file" ) self.Bind(wx.EVT_MENU, self.onClose, closeMenuItem) exitMenuItem = fileMenu.Append(wx.ID_EXIT, "Exit", "Exit the application") self.Bind(wx.EVT_MENU, self.onExit, exitMenuItem) menuBar.Append(fileMenu, "&File") helpMenu = wx.Menu() helpMenuItem = helpMenu.Append(wx.ID_HELP, "Help", "Get help") menuBar.Append(helpMenu, "&Help") self.SetMenuBar(menuBar)
def __init__(self, app_logic, *args, **kwargs): kwargs.setdefault('title', "Simple test App") wx.Frame.__init__(self, *args, **kwargs) self.app_logic = app_logic # put the Panel on the frame self.buttonPanel = ButtonPanel(self) # Build up the menu bar: menuBar = wx.MenuBar() fileMenu = wx.Menu() saveasMenuItem = fileMenu.Append(wx.ID_ANY, "&Save As", "Create a new file") self.Bind(wx.EVT_MENU, self.onSaveAs, saveasMenuItem ) openMenuItem = fileMenu.Append(wx.ID_ANY, "&Open", "Open an existing file" ) self.Bind(wx.EVT_MENU, self.onOpen, openMenuItem) closeMenuItem = fileMenu.Append(wx.ID_ANY, "&Close", "Close a file" ) self.Bind(wx.EVT_MENU, self.onClose, closeMenuItem) exitMenuItem = fileMenu.Append(wx.ID_EXIT, "Exit", "Exit the application") self.Bind(wx.EVT_MENU, self.onExit, exitMenuItem) menuBar.Append(fileMenu, "&File") helpMenu = wx.Menu() helpMenuItem = helpMenu.Append(wx.ID_HELP, "Help", "Get help") menuBar.Append(helpMenu, "&Help") self.SetMenuBar(menuBar)
def __init__(self, app_logic, *args, **kwargs): kwargs.setdefault('title', "Simple test App") wx.Frame.__init__(self, *args, **kwargs) self.app_logic = app_logic # put the Panel on the frame self.buttonPanel = MainForm(self) # Build up the menu bar: menuBar = wx.MenuBar() fileMenu = wx.Menu() openMenuItem = fileMenu.Append(wx.ID_ANY, "&Open", "Open a file" ) self.Bind(wx.EVT_MENU, self.onOpen, openMenuItem) closeMenuItem = fileMenu.Append(wx.ID_ANY, "&Close", "Close a file" ) self.Bind(wx.EVT_MENU, self.onClose, closeMenuItem) exitMenuItem = fileMenu.Append(wx.ID_EXIT, "Exit", "Exit the application") self.Bind(wx.EVT_MENU, self.onExit, exitMenuItem) menuBar.Append(fileMenu, "&File") helpMenu = wx.Menu() helpMenuItem = helpMenu.Append(wx.ID_HELP, "Help", "Get help") menuBar.Append(helpMenu, "&Help") self.SetMenuBar(menuBar)
def createMenus(self): # Creating the menubar. menuBar = wx.MenuBar() # Setting up the 'File' menu. self.menuFile = wx.Menu() self.menuFile.Append(ID_MENU_FILE_EXIT, "E&xit"," Terminate this program") menuBar.Append(self.menuFile,"&File") # Setting up the 'Phonebook' menu. self.menuPhonebook = wx.Menu() self.menuPhonebook.Append(ID_MENU_PHONEBOOK_ADN, "Phonebook (ADN)"," Manage your phonebook (Abbreviated Dial Numbers)") self.menuPhonebook.Append(ID_MENU_PHONEBOOK_FDN, "Fixed Dialing Numbers (FDN)"," Manage your Fixed Dialing Numbers") self.menuPhonebook.Append(ID_MENU_LND, "Last # dialed (LND)"," Manage your Fixed Dialing Numbers") menuBar.Append(self.menuPhonebook,"&Phonebook") # Setting up the 'SMS' menu. self.menuMessages = wx.Menu() self.menuMessages.Append(ID_MENU_SMS, "SMS"," Manage your SMS messages") menuBar.Append(self.menuMessages,"&Messages") # Setting up the 'SIM' menu. self.menuSIM = wx.Menu() self.menuSIM.Append(ID_MENU_SIM_INFO, "SIM Information"," Information about your SIM card") self.menuSIM.AppendSeparator() self.menuSIM.Append(ID_MENU_SIM_PIN_CHANGE, "Change PIN"," Change your PIN code (CHV1)") self.menuSIM.Append(ID_MENU_SIM_PIN_ENABLE, "Enable PIN"," Prompt for PIN when turning on phone") self.menuSIM.Append(ID_MENU_SIM_PIN_DISABLE, "Disable PIN"," Remove the PIN prompt when turning on phone") #self.menuSIM.AppendSeparator() #self.menuSIM.Append(ID_MENU_SIM_BACKUP, "Backup"," Backup your SIM information") #self.menuSIM.Append(ID_MENU_SIM_RESTORE, "Restore"," Restore your SIM information from a previous backup") menuBar.Append(self.menuSIM, "&SIM") # Setting up the menu. self.menuHelp = wx.Menu() self.menuHelp.Append(ID_MENU_HELP_HELP, "&Help"," Help documentation") self.menuHelp.AppendSeparator() self.menuHelp.Append(ID_MENU_HELP_ABOUT, "&About"," Information about this program") menuBar.Append(self.menuHelp,"&Help") # Adding the MenuBar to the Frame content. self.SetMenuBar(menuBar) #Add the menu handlers wx.EVT_MENU(self, ID_MENU_FILE_EXIT, self.closeWindow) wx.EVT_MENU(self, ID_MENU_PHONEBOOK_ADN, self.buttonPhonebook) wx.EVT_MENU(self, ID_MENU_PHONEBOOK_FDN, self.buttonFDN) wx.EVT_MENU(self, ID_MENU_LND, self.buttonLND) wx.EVT_MENU(self, ID_MENU_SMS, self.buttonSMS) wx.EVT_MENU(self, ID_MENU_SIM_INFO, self.menuSIMInfo) wx.EVT_MENU(self, ID_MENU_SIM_PIN_CHANGE, self.menuChangePIN) wx.EVT_MENU(self, ID_MENU_SIM_PIN_ENABLE, self.menuEnablePIN) wx.EVT_MENU(self, ID_MENU_SIM_PIN_DISABLE, self.menuDisablePIN) wx.EVT_MENU(self, ID_MENU_HELP_HELP, self.menuHelpHelp) wx.EVT_MENU(self, ID_MENU_HELP_ABOUT, self.menuHelpAbout)
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, pos=(150, 150), size=(350, 200)) # Create the menubar menuBar = wx.MenuBar() # and a menu menu = wx.Menu() # add an item to the menu, using \tKeyName automatically # creates an accelerator, the third param is some help text # that will show up in the statusbar menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample") # bind the menu event to an event handler self.Bind(wx.EVT_MENU, self.on_time_to_close, id=wx.ID_EXIT) # and put the menu on the menubar menuBar.Append(menu, "&File") self.SetMenuBar(menuBar) self.CreateStatusBar() # Now create the Panel to put the other controls on. panel = wx.Panel(self) # and a few controls text = wx.StaticText(panel, -1, "Hello World!") text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD)) text.SetSize(text.GetBestSize()) btn = wx.Button(panel, -1, "Close") funbtn = wx.Button(panel, -1, "Just for fun...") # bind the button events to handlers self.Bind(wx.EVT_BUTTON, self.on_time_to_close, btn) self.Bind(wx.EVT_BUTTON, self.on_fun_button, funbtn) # Use a sizer to layout the controls, stacked vertically and with # a 10 pixel border around each sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(text, 0, wx.ALL, 10) sizer.Add(btn, 0, wx.ALL, 10) sizer.Add(funbtn, 0, wx.ALL, 10) panel.SetSizer(sizer) panel.Layout()
def __init__(self, parent, title): """Create the pydicom image example's main frame window.""" wx.Frame.__init__(self, parent, id=-1, title="", pos=wx.DefaultPosition, size=wx.Size(w=1024, h=768), style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER | wx.CLIP_CHILDREN) # -------------------------------------------------------- # Set up the menubar. # -------------------------------------------------------- self.mainmenu = wx.MenuBar() # Make the 'File' menu. menu = wx.Menu() item = menu.Append(wx.ID_ANY, '&Open', 'Open file for editing') self.Bind(wx.EVT_MENU, self.OnFileOpen, item) item = menu.Append(wx.ID_ANY, 'E&xit', 'Exit Program') self.Bind(wx.EVT_MENU, self.OnFileExit, item) self.mainmenu.Append(menu, '&File') # Attach the menu bar to the window. self.SetMenuBar(self.mainmenu) # -------------------------------------------------------- # Set up the main splitter window. # -------------------------------------------------------- self.mainSplitter = wx.SplitterWindow(self, style=wx.NO_3D | wx.SP_3D) self.mainSplitter.SetMinimumPaneSize(1) # ------------------------------------------------------------- # Create the folderTreeView on the left. # ------------------------------------------------------------- self.dsTreeView = wx.TreeCtrl(self.mainSplitter, style=wx.TR_LINES_AT_ROOT | wx.TR_HAS_BUTTONS) # -------------------------------------------------------- # Create the ImageView on the right pane. # -------------------------------------------------------- self.imView = wx.Panel(self.mainSplitter, style=wx.VSCROLL | wx.HSCROLL | wx.CLIP_CHILDREN) self.imView.Bind(wx.EVT_PAINT, self.OnPaint) self.imView.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.imView.Bind(wx.EVT_SIZE, self.OnSize) # -------------------------------------------------------- # Install the splitter panes. # -------------------------------------------------------- self.mainSplitter.SplitVertically(self.dsTreeView, self.imView) self.mainSplitter.SetSashPosition(300, True) # -------------------------------------------------------- # Initialize some values # -------------------------------------------------------- self.dcmdsRoot = False self.foldersRoot = False self.loadCentered = True self.bitmap = None self.Show(True)
def SetMenu(self): menu1 = wx.Menu() menu2=wx.Menu() menu3=wx.Menu() menu5=wx.Menu() menu4=wx.Menu() menu6=wx.Menu() menu7=wx.Menu() menu1.Append(110, "&Exit") menu2.Append(115, "&Complete Report")#sub menu2.Append(116, "&Second Term Only") #sub menu3.AppendMenu(180, "&Progress Report",menu2) menu3.Append(118, "P&romotion List") menu3.Append(117, "C&ustom Reports") #menu6.Append(116, "&Statistics") menuBar = wx.MenuBar() menuBar.Append(menu1, "&File"); menuBar.Append(menu3, "&Reports"); self.SetMenuBar(menuBar) wx.EVT_MENU(self, 110, self.OnMenu_Exit) wx.EVT_MENU(self, 115, self.OnMenu_PerformanceReport) wx.EVT_MENU(self, 116, self.OnMenu_Performance_T2_Only) wx.EVT_MENU(self, 117, self.OnMenu_Custom) wx.EVT_MENU(self, 118, self.OnPromotion_List)