本文整理汇总了Python中wx.EVT_MENU属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_MENU属性的具体用法?Python wx.EVT_MENU怎么用?Python wx.EVT_MENU使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_MENU属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_ctrls
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_MENU [as 别名]
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)
示例2: _build_menu_bar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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)
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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)
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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)
示例5: updateAxes
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_MENU [as 别名]
def updateAxes(self, maxAxis):
"""Ensures that there are entries for max_axis axes in the menu
(selected by default)."""
if maxAxis > len(self._axisId):
for i in range(len(self._axisId) + 1, maxAxis + 1):
menuId = wx.NewId()
self._axisId.append(menuId)
self._menu.Append(menuId, "Axis %d" % i,
"Select axis %d" % i,
True)
self._menu.Check(menuId, True)
self.Bind(wx.EVT_MENU, self._onMenuItemSelected, id=menuId)
elif maxAxis < len(self._axisId):
for menuId in self._axisId[maxAxis:]:
self._menu.Delete(menuId)
self._axisId = self._axisId[:maxAxis]
self._toolbar.set_active(list(range(maxAxis)))
示例6: OnInit
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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
示例7: OnCardRightClick
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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()
示例8: OnReaderRightClick
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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()
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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)
示例10: updateAxes
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_MENU [as 别名]
def updateAxes(self, maxAxis):
"""Ensures that there are entries for max_axis axes in the menu
(selected by default)."""
if maxAxis > len(self._axisId):
for i in range(len(self._axisId) + 1, maxAxis + 1, 1):
menuId = wx.NewId()
self._axisId.append(menuId)
self._menu.Append(menuId, "Axis %d" % i,
"Select axis %d" % i,
True)
self._menu.Check(menuId, True)
self.Bind(wx.EVT_MENU, self._onMenuItemSelected, id=menuId)
elif maxAxis < len(self._axisId):
for menuId in self._axisId[maxAxis:]:
self._menu.Delete(menuId)
self._axisId = self._axisId[:maxAxis]
self._toolbar.set_active(list(range(maxAxis)))
示例11: CreateMenuItem
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_MENU [as 别名]
def CreateMenuItem(self, menu, label, func, icon=None, id=None):
if id:
item = wx.MenuItem(menu, id, label)
else:
item = wx.MenuItem(menu, -1, label)
if icon:
item.SetBitmap(wx.Bitmap(icon))
if id:
self.Bind(wx.EVT_MENU, func, id=id)
else:
self.Bind(wx.EVT_MENU, func, id=item.GetId())
if wxgtk4 :
menu.Append(item)
else:
menu.AppendItem(item)
return item
示例12: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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())
示例13: CreatePopupMenu
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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
示例14: makeMenuBar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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)
示例15: _on_template
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_MENU [as 别名]
def _on_template(self, event):
"""Event handler for the wx.EVT_MENU of the custom_format_menu menu items."""
label = self.custom_format_menu.GetLabelText(event.GetId())
label = label.lower().replace(' ', '_')
custom_format = self.filename_custom_format.GetValue()
if label == "ext":
prefix = '.'
else:
prefix = '-'
if not custom_format or custom_format[-1] == os_sep:
# If the custom format is empty or ends with path separator
# remove the prefix
prefix = ''
template = "{0}%({1})s".format(prefix, label)
self.filename_custom_format.SetValue(custom_format + template)