当前位置: 首页>>代码示例>>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;未经允许,请勿转载。