當前位置: 首頁>>代碼示例>>Python>>正文


Python wx.Menu方法代碼示例

本文整理匯總了Python中wx.Menu方法的典型用法代碼示例。如果您正苦於以下問題:Python wx.Menu方法的具體用法?Python wx.Menu怎麽用?Python wx.Menu使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在wx的用法示例。


在下文中一共展示了wx.Menu方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _build_menu_bar

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
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) 
開發者ID:marcelstoer,項目名稱:nodemcu-pyflasher,代碼行數:20,代碼來源:Main.py

示例2: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
def __init__(self, parent):

        wx.Button.__init__(self, parent, _NTB_AXISMENU_BUTTON, "Axes:        ",
                          style=wx.BU_EXACTFIT)
        self._toolbar = parent
        self._menu =wx.Menu()
        self._axisId = []
        # First two menu items never change...
        self._allId =wx.NewId()
        self._invertId =wx.NewId()
        self._menu.Append(self._allId, "All", "Select all axes", False)
        self._menu.Append(self._invertId, "Invert", "Invert axes selected", False)
        self._menu.AppendSeparator()

        bind(self, wx.EVT_BUTTON, self._onMenuButton, id=_NTB_AXISMENU_BUTTON)
        bind(self, wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId)
        bind(self, wx.EVT_MENU, self._handleInvertAxesSelected, id=self._invertId) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:19,代碼來源:backend_wx.py

示例3: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
def __init__(self, parent):

        wx.Button.__init__(self, parent, wx.ID_ANY, "Axes:        ",
                           style=wx.BU_EXACTFIT)
        self._toolbar = parent
        self._menu = wx.Menu()
        self._axisId = []
        # First two menu items never change...
        self._allId = wx.NewId()
        self._invertId = wx.NewId()
        self._menu.Append(self._allId, "All", "Select all axes", False)
        self._menu.Append(self._invertId, "Invert", "Invert axes selected",
                          False)
        self._menu.AppendSeparator()

        self.Bind(wx.EVT_BUTTON, self._onMenuButton, id=self.GetId())
        self.Bind(wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId)
        self.Bind(wx.EVT_MENU, self._handleInvertAxesSelected,
                  id=self._invertId) 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:21,代碼來源:backend_wx.py

示例4: wxPythonApp

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
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()) 
開發者ID:PacktPublishing,項目名稱:Python-GUI-Programming-Cookbook-Second-Edition,代碼行數:20,代碼來源:Control_Frameworks.py

示例5: OnInit

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
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 
開發者ID:PacktPublishing,項目名稱:Python-GUI-Programming-Cookbook-Second-Edition,代碼行數:27,代碼來源:import_OpenGL_cube_and_cone.py

示例6: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
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() 
開發者ID:PacktPublishing,項目名稱:Python-GUI-Programming-Cookbook-Second-Edition,代碼行數:24,代碼來源:wxPython_Wallpaper.py

示例7: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
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() 
開發者ID:PacktPublishing,項目名稱:Python-GUI-Programming-Cookbook-Second-Edition,代碼行數:19,代碼來源:wxPython_OpenGL_GUI.py

示例8: OnCardRightClick

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
def OnCardRightClick(self, event):
        """Called when user right-clicks a node in the card tree control."""
        item = event.GetItem()
        if item:
            itemdata = self.readertreepanel.cardtreectrl.GetItemPyData(item)
            if isinstance(itemdata, smartcard.Card.Card):
                self.selectedcard = itemdata
                if not hasattr(self, "connectID"):
                    self.connectID = wx.NewId()
                    self.disconnectID = wx.NewId()

                    self.Bind(wx.EVT_MENU, self.OnConnect, id=self.connectID)
                    self.Bind(
                        wx.EVT_MENU, self.OnDisconnect, id=self.disconnectID)

                menu = wx.Menu()
                if not hasattr(self.selectedcard, 'connection'):
                    menu.Append(self.connectID, "Connect")
                else:
                    menu.Append(self.disconnectID, "Disconnect")
                self.PopupMenu(menu)
                menu.Destroy() 
開發者ID:LudovicRousseau,項目名稱:pyscard,代碼行數:24,代碼來源:SimpleSCardAppFrame.py

示例9: OnReaderRightClick

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
def OnReaderRightClick(self, event):
        """Called when user right-clicks a node in the reader tree control."""
        item = event.GetItem()
        if item:
            itemdata = self.readertreepanel.readertreectrl.GetItemPyData(item)
            if isinstance(itemdata, smartcard.Card.Card):
                self.selectedcard = itemdata
                if not hasattr(self, "connectID"):
                    self.connectID = wx.NewId()
                    self.disconnectID = wx.NewId()

                    self.Bind(wx.EVT_MENU, self.OnConnect, id=self.connectID)
                    self.Bind(
                        wx.EVT_MENU, self.OnDisconnect, id=self.disconnectID)

                menu = wx.Menu()
                if not hasattr(self.selectedcard, 'connection'):
                    menu.Append(self.connectID, "Connect")
                else:
                    menu.Append(self.disconnectID, "Disconnect")
                self.PopupMenu(menu)
                menu.Destroy() 
開發者ID:LudovicRousseau,項目名稱:pyscard,代碼行數:24,代碼來源:SimpleSCardAppFrame.py

示例10: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
def __init__(self, parent):

        wx.Button.__init__(self, parent, _NTB_AXISMENU_BUTTON, "Axes:        ",
                           style=wx.BU_EXACTFIT)
        self._toolbar = parent
        self._menu = wx.Menu()
        self._axisId = []
        # First two menu items never change...
        self._allId = wx.NewId()
        self._invertId = wx.NewId()
        self._menu.Append(self._allId, "All", "Select all axes", False)
        self._menu.Append(self._invertId, "Invert", "Invert axes selected",
                          False)
        self._menu.AppendSeparator()

        self.Bind(wx.EVT_BUTTON, self._onMenuButton, id=_NTB_AXISMENU_BUTTON)
        self.Bind(wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId)
        self.Bind(wx.EVT_MENU, self._handleInvertAxesSelected,
                  id=self._invertId) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:21,代碼來源:backend_wx.py

示例11: CreatePopupMenu

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
def CreatePopupMenu(self):
        """Method called by WX library when user right clicks tray icon. Opens tray menu."""
        menu = wx.Menu()
        create_menu_item(menu, "Open Config Folder", self.open_config)
        create_menu_item(menu, "Wallpaper Configuration", self.configure_wallpapers)
        create_menu_item(menu, "Settings", self.configure_settings)
        create_menu_item(menu, "Reload Profiles", self.reload_profiles)
        menu.AppendSeparator()
        for item in self.list_of_profiles:
            create_menu_item(menu, item.name, self.start_profile, item)
        menu.AppendSeparator()
        create_menu_item(menu, "Next Wallpaper", self.next_wallpaper)
        self.pause_item = create_menu_item(
            menu, "Pause Timer", self.pause_timer, kind=wx.ITEM_CHECK)
        self.pause_item.Check(self.is_paused)
        menu.AppendSeparator()
        create_menu_item(menu, 'About', self.on_about)
        create_menu_item(menu, 'Exit', self.on_exit)
        return menu 
開發者ID:hhannine,項目名稱:superpaper,代碼行數:21,代碼來源:tray.py

示例12: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
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()) 
開發者ID:alesnav,項目名稱:p2ptv-pi,代碼行數:18,代碼來源:systray.py

示例13: CreatePopupMenu

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
def CreatePopupMenu(self):
        menu = wx.Menu()
        mi = menu.Append(wx.ID_ANY, self.bgapp.utility.lang.get('options_etc'))
        self.Bind(wx.EVT_MENU, self.OnOptions, id=mi.GetId())
        menu.AppendSeparator()
        if self.bgapp.user_profile is not None:
            mi = menu.Append(wx.ID_ANY, self.bgapp.utility.lang.get('user_profile'))
            self.Bind(wx.EVT_MENU, self.OnUserProfile, id=mi.GetId())
            menu.AppendSeparator()
        mi = menu.Append(wx.ID_ANY, self.bgapp.utility.lang.get('create_stream'))
        self.Bind(wx.EVT_MENU, self.OnStream, id=mi.GetId())
        menu.AppendSeparator()
        if DEBUG:
            mi = menu.Append(wx.ID_ANY, 'Statistics')
            self.Bind(wx.EVT_MENU, self.OnStat, id=mi.GetId())
            menu.AppendSeparator()
        if DEBUG_LIVE:
            mi = menu.Append(wx.ID_ANY, 'Live')
            self.Bind(wx.EVT_MENU, self.OnLive, id=mi.GetId())
            menu.AppendSeparator()
        mi = menu.Append(wx.ID_ANY, self.bgapp.utility.lang.get('menuexit'))
        self.Bind(wx.EVT_MENU, self.OnExitClient, id=mi.GetId())
        return menu 
開發者ID:alesnav,項目名稱:p2ptv-pi,代碼行數:25,代碼來源:systray.py

示例14: makeMenuBar

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
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) 
開發者ID:chonepieceyb,項目名稱:reading-frustum-pointnets-code,代碼行數:21,代碼來源:gui.py

示例15: _init_utils

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Menu [as 別名]
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) 
開發者ID:jgeisler0303,項目名稱:CANFestivino,代碼行數:18,代碼來源:objdictedit.py


注:本文中的wx.Menu方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。