Python wx.MenuBar() Examples

The following are 30 code examples of wx.MenuBar(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: rstbx_frame.py    From dials with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        super(XrayFrame, self).__init__(*args, **kwds)
        self.settings = rstbx.viewer.settings()
        self.viewer = rstbx.viewer.display.XrayView(self, -1, size=(1024, 640))
        self.viewer.SetMinSize((640, 640))
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.sizer)
        self.sizer.Add(self.viewer, 1, wx.EXPAND)
        self.statusbar = self.CreateStatusBar()
        self.settings_frame = None
        self.zoom_frame = None
        self.zoom_3d = None
        self.plot_frame = None
        self._img = None
        self._distl = None
        self.toolbar = self.CreateToolBar(style=wx.TB_3DBUTTONS | wx.TB_TEXT)
        self.setup_toolbar()
        self.toolbar.Realize()
        self.mb = wx.MenuBar()
        self.setup_menus()
        self.SetMenuBar(self.mb)
        self.Fit()
        self.SetMinSize(self.GetSize())
        self.OnShowSettings(None)
        self.Bind(EVT_EXTERNAL_UPDATE, self.OnExternalUpdate) 
Example #2
Source File: gui.py    From reading-frustum-pointnets-code with Apache License 2.0 6 votes vote down vote up
def makeMenuBar(self):
        fileMenu = wx.Menu()
        helloItem = fileMenu.Append(-1, "&Hello...\tCtrl-H",
                                    "Help string shown in status bar for this menu item")
        fileMenu.AppendSeparator()

        exitItem = fileMenu.Append(wx.ID_EXIT)
        helpMenu = wx.Menu()
        aboutItem = helpMenu.Append(wx.ID_ABOUT)

        menuBar = wx.MenuBar()
        menuBar.Append(fileMenu, "&File")
        menuBar.Append(helpMenu, "Help")

        self.SetMenuBar(menuBar)

        self.Bind(wx.EVT_MENU, self.OnHello, helloItem)
        self.Bind(wx.EVT_MENU, self.OnExit, exitItem)
        self.Bind(wx.EVT_MENU, self.OnAbout, aboutItem) 
Example #3
Source File: Control_Frameworks.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 6 votes vote down vote up
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()) 
Example #4
Source File: objdictedit.py    From CANFestivino with GNU Lesser General Public License v2.1 6 votes vote down vote up
def _init_utils(self):
        self.MenuBar = wx.MenuBar()
        self.MenuBar.SetEvtHandlerEnabled(True)

        if self.ModeSolo:
            self.FileMenu = wx.Menu(title='')
        self.EditMenu = wx.Menu(title='')
        self.AddMenu = wx.Menu(title='')
        self.HelpMenu = wx.Menu(title='')

        self._init_coll_MenuBar_Menus(self.MenuBar)
        if self.ModeSolo:
            self._init_coll_FileMenu_Items(self.FileMenu)
        self._init_coll_EditMenu_Items(self.EditMenu)
        self._init_coll_AddMenu_Items(self.AddMenu)
        self._init_coll_HelpMenu_Items(self.HelpMenu) 
Example #5
Source File: objdictedit.py    From CANFestivino with GNU Lesser General Public License v2.1 6 votes vote down vote up
def _init_ctrls(self, prnt):
        wx.Frame.__init__(self, id=ID_OBJDICTEDIT, name='objdictedit',
              parent=prnt, pos=wx.Point(149, 178), size=wx.Size(1000, 700),
              style=wx.DEFAULT_FRAME_STYLE, title=_('Objdictedit'))
        self._init_utils()
        self.SetClientSize(wx.Size(1000, 700))
        self.SetMenuBar(self.MenuBar)
        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        if not self.ModeSolo:
            self.Bind(wx.EVT_MENU, self.OnSaveMenu, id=wx.ID_SAVE)
            accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL, 83, wx.ID_SAVE)])
            self.SetAcceleratorTable(accel)

        self.FileOpened = wx.Notebook(id=ID_OBJDICTEDITFILEOPENED,
              name='FileOpened', parent=self, pos=wx.Point(0, 0),
              size=wx.Size(0, 0), style=0)
        self.FileOpened.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,
              self.OnFileSelectedChanged, id=ID_OBJDICTEDITFILEOPENED)

        self.HelpBar = wx.StatusBar(id=ID_OBJDICTEDITHELPBAR, name='HelpBar',
              parent=self, style=wx.ST_SIZEGRIP)
        self._init_coll_HelpBar_Fields(self.HelpBar)
        self.SetStatusBar(self.HelpBar) 
Example #6
Source File: objdictedit.py    From CANFestivino with GNU Lesser General Public License v2.1 6 votes vote down vote up
def RefreshMainMenu(self):
        if self.FileOpened.GetPageCount() > 0:
            if self.ModeSolo:
                self.MenuBar.EnableTop(1, True)
                self.MenuBar.EnableTop(2, True)
                self.FileMenu.Enable(wx.ID_CLOSE, True)
                self.FileMenu.Enable(wx.ID_SAVE, True)
                self.FileMenu.Enable(wx.ID_SAVEAS, True)
                self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUEXPORTEDS, True)
                self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUEXPORTC, True)
            else:
                self.MenuBar.EnableTop(0, True)
                self.MenuBar.EnableTop(1, True)
        else:
            if self.ModeSolo:
                self.MenuBar.EnableTop(1, False)
                self.MenuBar.EnableTop(2, False)
                self.FileMenu.Enable(wx.ID_CLOSE, False)
                self.FileMenu.Enable(wx.ID_SAVE, False)
                self.FileMenu.Enable(wx.ID_SAVEAS, False)
                self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUEXPORTEDS, False)
                self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUEXPORTC, False)
            else:
                self.MenuBar.EnableTop(0, False)
                self.MenuBar.EnableTop(1, False) 
Example #7
Source File: networkedit.py    From CANFestivino with GNU Lesser General Public License v2.1 6 votes vote down vote up
def _init_utils(self):
        self.MenuBar = wx.MenuBar()
        self.MenuBar.SetEvtHandlerEnabled(True)
        
        if self.ModeSolo:
            self.FileMenu = wx.Menu(title='')
        self.NetworkMenu = wx.Menu(title='')
        self.EditMenu = wx.Menu(title='')
        self.AddMenu = wx.Menu(title='')
        self.HelpMenu = wx.Menu(title='')

        self._init_coll_MenuBar_Menus(self.MenuBar)
        if self.ModeSolo:
            self._init_coll_FileMenu_Items(self.FileMenu)
        self._init_coll_NetworkMenu_Items(self.NetworkMenu)
        self._init_coll_EditMenu_Items(self.EditMenu)
        self._init_coll_AddMenu_Items(self.AddMenu)
        self._init_coll_HelpMenu_Items(self.HelpMenu) 
Example #8
Source File: systray.py    From p2ptv-pi with MIT License 6 votes vote down vote up
def __init__(self, wxapp, bgapp, iconfilename):
        wx.TaskBarIcon.__init__(self)
        self.bgapp = bgapp
        self.wxapp = wxapp
        self.icons = wx.IconBundle()
        self.icon = wx.Icon(iconfilename, wx.BITMAP_TYPE_ICO)
        self.icons.AddIcon(self.icon)
        self.Bind(wx.EVT_TASKBAR_LEFT_UP, self.OnLeftClicked)
        if sys.platform != 'darwin':
            self.SetIcon(self.icon, self.bgapp.appname)
        else:
            menuBar = wx.MenuBar()
            filemenu = wx.Menu()
            item = filemenu.Append(-1, 'E&xit', 'Terminate the program')
            self.Bind(wx.EVT_MENU, self.OnExit, item)
            wx.App.SetMacExitMenuItemId(item.GetId()) 
Example #9
Source File: wx_mpl_bars.py    From code-for-blog with The Unlicense 6 votes vote down vote up
def create_menu(self):
        self.menubar = wx.MenuBar()
        
        menu_file = wx.Menu()
        m_expt = menu_file.Append(-1, "&Save plot\tCtrl-S", "Save plot to file")
        self.Bind(wx.EVT_MENU, self.on_save_plot, m_expt)
        menu_file.AppendSeparator()
        m_exit = menu_file.Append(-1, "E&xit\tCtrl-X", "Exit")
        self.Bind(wx.EVT_MENU, self.on_exit, m_exit)
        
        menu_help = wx.Menu()
        m_about = menu_help.Append(-1, "&About\tF1", "About the demo")
        self.Bind(wx.EVT_MENU, self.on_about, m_about)
        
        self.menubar.Append(menu_file, "&File")
        self.menubar.Append(menu_help, "&Help")
        self.SetMenuBar(self.menubar) 
Example #10
Source File: networkedit.py    From CANFestivino with GNU Lesser General Public License v2.1 6 votes vote down vote up
def _init_ctrls(self, prnt):
        wx.Frame.__init__(self, id=ID_NETWORKEDIT, name='networkedit',
              parent=prnt, pos=wx.Point(149, 178), size=wx.Size(1000, 700),
              style=wx.DEFAULT_FRAME_STYLE, title=_('Networkedit'))
        self._init_utils()
        self.SetClientSize(wx.Size(1000, 700))
        self.SetMenuBar(self.MenuBar)
        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        if not self.ModeSolo:
            self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE)
            accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL, 83, wx.ID_SAVE)])
            self.SetAcceleratorTable(accel)

        NetworkEditorTemplate._init_ctrls(self, self)

        self.HelpBar = wx.StatusBar(id=ID_NETWORKEDITHELPBAR, name='HelpBar',
              parent=self, style=wx.ST_SIZEGRIP)
        self._init_coll_HelpBar_Fields(self.HelpBar)
        self.SetStatusBar(self.HelpBar) 
Example #11
Source File: gui.py    From four_flower with MIT License 6 votes vote down vote up
def makeMenuBar(self):
        fileMenu = wx.Menu()
        helloItem = fileMenu.Append(-1, "&Hello...\tCtrl-H",
                                    "Help string shown in status bar for this menu item")
        fileMenu.AppendSeparator()

        exitItem = fileMenu.Append(wx.ID_EXIT)
        helpMenu = wx.Menu()
        aboutItem = helpMenu.Append(wx.ID_ABOUT)

        menuBar = wx.MenuBar()
        menuBar.Append(fileMenu, "&File")
        menuBar.Append(helpMenu, "Help")

        self.SetMenuBar(menuBar)

        self.Bind(wx.EVT_MENU, self.OnHello, helloItem)
        self.Bind(wx.EVT_MENU, self.OnExit, exitItem)
        self.Bind(wx.EVT_MENU, self.OnAbout, aboutItem) 
Example #12
Source File: wxPython_OpenGL_GUI.py    From Python-GUI-Programming-Cookbook-Second-Edition with MIT License 6 votes vote down vote up
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() 
Example #13
Source File: import_OpenGL_cube_and_cone.py    From Python-GUI-Programming-Cookbook-Second-Edition with MIT License 6 votes vote down vote up
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 
Example #14
Source File: Main.py    From nodemcu-pyflasher with MIT License 6 votes vote down vote up
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) 
Example #15
Source File: wxpython_toggle.py    From R421A08-rs485-8ch-relay-board with MIT License 6 votes vote down vote up
def CreateMenuBar(self):
        # Create menu
        m_menubar = wx.MenuBar(0)

        # File menu
        m_menuFile = wx.Menu()
        m_menuItemQuit = wx.MenuItem(m_menuFile, wx.ID_ANY, u'&Quit' + u'\t' + u'Ctrl+Q',
                                     wx.EmptyString, wx.ITEM_NORMAL)
        m_menuFile.Append(m_menuItemQuit)
        m_menubar.Append(m_menuFile, u'&File')

        # About menu
        m_menuAbout = wx.Menu()
        m_menuItemAbout = wx.MenuItem(m_menuAbout, wx.ID_ANY, u'&About' + u'\t' + u'Shift+?',
                                      wx.EmptyString, wx.ITEM_NORMAL)
        m_menuAbout.Append(m_menuItemAbout)
        m_menubar.Append(m_menuAbout, u'&Help')

        # Set menu
        self.SetMenuBar(m_menubar)

        self.Bind(wx.EVT_MENU, self.OnMenuQuit, id=m_menuItemQuit.GetId())
        self.Bind(wx.EVT_MENU, self.OnMenuAbout, id=m_menuItemAbout.GetId()) 
Example #16
Source File: menubar.py    From wxGlade with MIT License 6 votes vote down vote up
def _create_popup_menu(self, widget=None):
        if widget is None: widget = self.widget
        menu = misc.wxGladePopupMenu(self.name)

        if self.widget and self.is_visible():
            item = misc.append_menu_item(menu, -1, _('Hide'))
            misc.bind_menu_item_after(widget, item, self.hide_widget)
        else:
            i = misc.append_menu_item(menu, -1, _('Show'))
            misc.bind_menu_item_after(widget, i, common.app_tree.show_toplevel, None, self)
        menu.AppendSeparator()

        item = misc.append_menu_item(menu, -1, _('Remove MenuBar\tDel'), wx.ART_DELETE)
        misc.bind_menu_item_after(widget, item, self.remove)

        item = misc.append_menu_item(menu, -1, _('Edit menus ...'))
        misc.bind_menu_item_after(widget, item, self.properties["menus"].edit_menus)

        return menu 
Example #17
Source File: menubar.py    From wxGlade with MIT License 6 votes vote down vote up
def create_widget(self):
        if self.IS_TOPLEVEL:
            # "top-level" menubar
            self.widget = wx.Frame(None, -1, misc.design_title(self.name))
            self.widget.SetClientSize((400, 30))
            self._mb = wx.MenuBar()
            self.widget.SetMenuBar(self._mb)
            self.widget.SetBackgroundColour(self._mb.GetBackgroundColour())
            import os
            icon = compat.wx_EmptyIcon()
            xpm = os.path.join(config.icons_path, 'menubar.xpm')
            icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
            self.widget.SetIcon(icon)
            self.widget.Bind(wx.EVT_CLOSE, lambda e: self.hide_widget())
        else:
            if wx.Platform=="_WXMAC__": return   # XXX check how a toplevel menu bar behaves on Mac OS
            self.widget = self._mb = wx.MenuBar()
            if self.parent.widget: self.parent.widget.SetMenuBar(self.widget)
            if wx.Platform == '__WXMSW__' or wx.Platform == '__WXMAC__':
                self.widget.SetFocus = lambda : None

        self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)
        self.set_menus()  # show the menus 
Example #18
Source File: Control_Frameworks.py    From Python-GUI-Programming-Cookbook-Second-Edition with MIT License 6 votes vote down vote up
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()) 
Example #19
Source File: wxPython_Wallpaper.py    From Python-GUI-Programming-Cookbook-Second-Edition with MIT License 6 votes vote down vote up
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() 
Example #20
Source File: BasesEtc_Classic.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrameWithBases.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        TestFrame.__init__(self, *args, **kwds)
        testframe.TestFrame.__init__(self)
        self.SetSize((400, 300))
        self.SetTitle("frame")

        # Menu Bar
        self.frame_copy_menubar = wx.MenuBar()
        self.SetMenuBar(self.frame_copy_menubar)
        # Menu Bar end

        self.frame_copy_statusbar = self.CreateStatusBar(1)
        self.frame_copy_statusbar.SetStatusWidths([-1])
        # statusbar fields
        frame_copy_statusbar_fields = ["frame_copy_statusbar"]
        for i in range(len(frame_copy_statusbar_fields)):
            self.frame_copy_statusbar.SetStatusText(frame_copy_statusbar_fields[i], i)

        # Tool Bar
        self.frame_copy_toolbar = wx.ToolBar(self, -1)
        self.SetToolBar(self.frame_copy_toolbar)
        self.frame_copy_toolbar.Realize()
        # Tool Bar end

        self.panel_1 = TestPanelWithBasesInFrame(self, wx.ID_ANY)
        self.Layout()
        # end wxGlade

# end of class MyFrameWithBases 
Example #21
Source File: archiveplayer.py    From webarchiveplayer with GNU General Public License v3.0 5 votes vote down vote up
def init_controls(self, contents=None, title=None, player_url=PLAYER_URL):
        self.menu_bar  = wx.MenuBar()
        self.help_menu = wx.Menu()

        self.help_menu.Append(wx.ID_EXIT,   "&QUIT")

        if wx.Platform != "__WXMAC__":
            self.menu_bar.Append(self.help_menu, "File")

        self.Bind(wx.EVT_MENU, self.quit, id=wx.ID_EXIT)
        self.SetMenuBar(self.menu_bar)

        self.html = wx.html.HtmlWindow(self)
        self.html.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.on_load_url)

        if not title:
            title = 'Web Archive Player ' + __version__

        self.SetTitle(title)

        if not contents:
            contents = DEFAULT_HTML_PAGE

        contents = contents.format(version=__version__,
                                   pywb_version=pywb_version,
                                   player_url=player_url,
                                   info_url=INFO_URL)

        self.html.SetPage(contents)

        # set later
        self.archiveplayer = None 
Example #22
Source File: BasesEtc_Classic.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyMenuBar.__init__
        wx.MenuBar.__init__(self, *args, **kwds)
        # end wxGlade

# end of class MyMenuBar 
Example #23
Source File: BasesEtc.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyMenuBar.__init__
        wx.MenuBar.__init__(self, *args, **kwds)
        # end wxGlade

# end of class MyMenuBar 
Example #24
Source File: BasesEtc_Phoenix.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyMenuBar.__init__
        wx.MenuBar.__init__(self, *args, **kwds)
        # end wxGlade

# end of class MyMenuBar 
Example #25
Source File: Menu_Test.py    From topoflow with MIT License 5 votes vote down vote up
def __init__(self):
        wx.Frame.__init__(self, None, -1, "Simple Menu Example")
        p = wx.Panel(self)
        menuBar = wx.MenuBar()
        menu = wx.Menu()
        menuBar.Append(menu, "Left Menu")
        menu2 = wx.Menu()
        menuBar.Append(menu2, "Middle Menu")
        menu3 = wx.Menu()
        menuBar.Append(menu3, "Right Menu")
        self.SetMenuBar(menuBar)
        self.Show(True) 
Example #26
Source File: frame_merger.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def __init__(self, style):
        wx.MenuBar.__init__(self, style)

        self.file = Menu_File()
        self.help = Menu_Help()

        self.Append(self.file, 'File')
        self.Append(self.help, 'Help') 
Example #27
Source File: frame_downloader.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def __init__(self, style):
        wx.MenuBar.__init__(self, style)

        self.file = Menu_File()
        self.help = Menu_Help()

        self.Append(self.file, 'File')
        self.Append(self.help, 'Help') 
Example #28
Source File: gui.py    From reversi-alpha-zero with MIT License 5 votes vote down vote up
def __init__(self, model: PlayWithHuman, gui_config: GuiConfig):
        self.model = model
        self.gui_config = gui_config
        self.is_flip_vertical = False
        self.show_player_evaluation = True
        wx.Frame.__init__(self, None, -1, self.gui_config.window_title, size=self.gui_config.window_size)
        # panel
        self.panel = wx.Panel(self)
        self.panel.Bind(wx.EVT_LEFT_DOWN, self.try_move)
        self.panel.Bind(wx.EVT_PAINT, self.refresh)

        self.new_game(human_is_black=True)
        # menu bar
        menu = wx.Menu()
        menu.Append(1, u"New Game(Black)")
        menu.Append(2, u"New Game(White)")
        menu.AppendSeparator()
        menu.Append(5, u"Flip Vertical")
        menu.Append(6, u"Show/Hide Player evaluation")
        menu.AppendSeparator()
        menu.Append(9, u"quit")
        menu_bar = wx.MenuBar()
        menu_bar.Append(menu, u"menu")
        self.SetMenuBar(menu_bar)
        self.Bind(wx.EVT_MENU, self.handle_new_game, id=1)
        self.Bind(wx.EVT_MENU, self.handle_new_game, id=2)
        self.Bind(wx.EVT_MENU, self.handle_flip_vertical, id=5)
        self.Bind(wx.EVT_MENU, self.handle_show_hide_player_evaluation, id=6)
        self.Bind(wx.EVT_MENU, self.handle_quit, id=9)

        # status bar
        self.CreateStatusBar()

        self.model.add_observer(self.handle_game_event) 
Example #29
Source File: frame_parser.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def __init__(self, style):
        wx.MenuBar.__init__(self, style)

        self.file = Menu_File()
        self.help = Menu_Help()

        self.Append(self.file, 'File')
        self.Append(self.help, 'Help') 
Example #30
Source File: LanguageEditor.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def CreateMenuBar(self):
        # menu creation
        menuBar = wx.MenuBar()

        def AddMenuItem(name, func, itemId):
            menu.Append(itemId, name)
            self.Bind(wx.EVT_MENU, func, id=itemId)

        # file menu
        menu = wx.Menu()
        menuBar.Append(menu, "&File")
        AddMenuItem("&Open...\tCtrl+O", self.OnCmdOpen, wx.ID_OPEN)
        AddMenuItem("&Save\tCtrl+S", self.OnCmdSave, wx.ID_SAVE)
        menu.AppendSeparator()
        AddMenuItem("E&xit\tAlt+F4", self.OnCmdExit, wx.ID_EXIT)

        # edit menu
        menu = wx.Menu()
        menuBar.Append(menu, "&Edit")
        AddMenuItem("&Undo\tCtrl+Z", self.OnCmdUndo, wx.ID_UNDO)
        AddMenuItem("&Redo\tCtrl+Y", self.OnCmdRedo, wx.ID_REDO)
        menu.AppendSeparator()
        AddMenuItem("Cu&t\tCtrl+X", self.OnCmdCut, wx.ID_CUT)
        AddMenuItem("&Copy\tCtrl+C", self.OnCmdCopy, wx.ID_COPY)
        AddMenuItem("&Paste\tCtrl+V", self.OnCmdPaste, wx.ID_PASTE)
        AddMenuItem("&Delete", self.OnCmdDelete, wx.ID_DELETE)
        menu.AppendSeparator()
        AddMenuItem(
            "Find &Next Untranslated\tF3", self.OnCmdFindNext, wx.ID_FIND
        )

        # help menu
        menu = wx.Menu()
        menuBar.Append(menu, "&Help")
        AddMenuItem("About Language Editor...", self.OnCmdAbout, wx.ID_ABOUT)

        self.SetMenuBar(menuBar)
        return menuBar