本文整理汇总了Python中wx.ITEM_CHECK属性的典型用法代码示例。如果您正苦于以下问题:Python wx.ITEM_CHECK属性的具体用法?Python wx.ITEM_CHECK怎么用?Python wx.ITEM_CHECK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.ITEM_CHECK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_toolbar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def _init_toolbar(self):
DEBUG_MSG("_init_toolbar", 1, self)
self._parent = self.canvas.GetParent()
self.wx_ids = {}
for text, tooltip_text, image_file, callback in self.toolitems:
if text is None:
self.AddSeparator()
continue
self.wx_ids[text] = (
self.AddTool(
-1,
bitmap=_load_bitmap(image_file + ".png"),
bmpDisabled=wx.NullBitmap,
label=text, shortHelp=text, longHelp=tooltip_text,
kind=(wx.ITEM_CHECK if text in ["Pan", "Zoom"]
else wx.ITEM_NORMAL))
.Id)
self.Bind(wx.EVT_TOOL, getattr(self, callback),
id=self.wx_ids[text])
self.Realize()
示例2: CreatePopupMenu
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [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
示例3: _set_tools
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def _set_tools(self):
if not self._tb: return # nothing left to do
self._tb.ClearTools()
# now add all the tools
for tool in self.tools:
if tool.id == '---': # the tool is a separator
self._tb.AddSeparator()
else:
bmp1 = self.get_preview_obj_bitmap(tool.bitmap1)
bmp2 = self.get_preview_obj_bitmap(tool.bitmap2) if tool.bitmap2.strip() else None
kinds = [wx.ITEM_NORMAL, wx.ITEM_CHECK, wx.ITEM_RADIO]
try:
kind = kinds[int(tool.type)]
except (ValueError, IndexError):
kind = wx.ITEM_NORMAL
ADD = self._tb.AddLabelTool if compat.IS_CLASSIC else self._tb.AddTool
if bmp2 is not None:
ADD( wx.NewId(), misc.wxstr(tool.label), bmp1, bmp2, kind,
misc.wxstr(tool.short_help), misc.wxstr(tool.long_help) )
else:
ADD( wx.NewId(), misc.wxstr(tool.label), bmp1, shortHelp=misc.wxstr(tool.short_help) )
# this is required to refresh the toolbar properly
self._refresh_widget()
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = kwds.get("style", 0)
wx.Frame.__init__(self, *args, **kwds)
self.SetSize((200, 200))
self.SetTitle("frame_1")
# Tool Bar
self.frame_1_toolbar = wx.ToolBar(self, -1)
self.frame_1_toolbar.AddLabelTool(wx.ID_UP, "UpDown", wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, "Up or Down", "Up or Down")
self.SetToolBar(self.frame_1_toolbar)
self.frame_1_toolbar.Realize()
# Tool Bar end
sizer_1 = wx.BoxSizer(wx.VERTICAL)
self.label_1 = wx.StaticText(self, wx.ID_ANY, "placeholder - every design\nneeds a toplevel window", style=wx.ALIGN_CENTER)
sizer_1.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
# end of class MyFrame
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = kwds.get("style", 0)
wx.Frame.__init__(self, *args, **kwds)
self.SetSize((200, 200))
self.SetTitle("frame_1")
# Tool Bar
self.frame_1_toolbar = wx.ToolBar(self, -1)
self.frame_1_toolbar.AddTool(wx.ID_UP, "UpDown", wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, "Up or Down", "Up or Down")
self.SetToolBar(self.frame_1_toolbar)
self.frame_1_toolbar.Realize()
# Tool Bar end
sizer_1 = wx.BoxSizer(wx.VERTICAL)
self.label_1 = wx.StaticText(self, wx.ID_ANY, "placeholder - every design\nneeds a toplevel window", style=wx.ALIGN_CENTER)
sizer_1.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
# end of class MyFrame
示例6: create_menu
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def create_menu(self):
self.menu = wx.Menu()
tools_menu = gui.mainFrame.sysTrayIcon.toolsMenu
# Translators: Item in NVDA Remote submenu to connect to a remote computer.
self.connect_item = self.menu.Append(wx.ID_ANY, _("Connect..."), _("Remotely connect to another computer running NVDA Remote Access"))
gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.do_connect, self.connect_item)
# Translators: Item in NVDA Remote submenu to disconnect from a remote computer.
self.disconnect_item = self.menu.Append(wx.ID_ANY, _("Disconnect"), _("Disconnect from another computer running NVDA Remote Access"))
self.disconnect_item.Enable(False)
gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.on_disconnect_item, self.disconnect_item)
# Translators: Menu item in NvDA Remote submenu to mute speech and sounds from the remote computer.
self.mute_item = self.menu.Append(wx.ID_ANY, _("Mute remote"), _("Mute speech and sounds from the remote computer"), kind=wx.ITEM_CHECK)
self.mute_item.Enable(False)
gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.on_mute_item, self.mute_item)
# Translators: Menu item in NVDA Remote submenu to push clipboard content to the remote computer.
self.push_clipboard_item = self.menu.Append(wx.ID_ANY, _("&Push clipboard"), _("Push the clipboard to the other machine"))
self.push_clipboard_item.Enable(False)
gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.on_push_clipboard_item, self.push_clipboard_item)
# Translators: Menu item in NVDA Remote submenu to copy a link to the current session.
self.copy_link_item = self.menu.Append(wx.ID_ANY, _("Copy &link"), _("Copy a link to the remote session"))
self.copy_link_item.Enable(False)
gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.on_copy_link_item, self.copy_link_item)
# Translators: Menu item in NvDA Remote submenu to open add-on options.
self.options_item = self.menu.Append(wx.ID_ANY, _("&Options..."), _("Options"))
gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.on_options_item, self.options_item)
# Translators: Menu item in NVDA Remote submenu to send Control+Alt+Delete to the remote computer.
self.send_ctrl_alt_del_item = self.menu.Append(wx.ID_ANY, _("Send Ctrl+Alt+Del"), _("Send Ctrl+Alt+Del"))
gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.on_send_ctrl_alt_del, self.send_ctrl_alt_del_item)
self.send_ctrl_alt_del_item.Enable(False)
# Translators: Label of menu in NVDA tools menu.
self.remote_item=tools_menu.AppendSubMenu(self.menu, _("R&emote"), _("NVDA Remote Access"))
示例7: _ToolBar_AddSimpleTool
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def _ToolBar_AddSimpleTool(self, toolId, bitmap, shortHelpString="", longHelpString="", isToggle=0):
"""
Old style method to add a tool to the toolbar.
"""
kind = wx.ITEM_NORMAL
if isToggle: kind = wx.ITEM_CHECK
return self.AddTool(toolId, '', bitmap, wx.NullBitmap, kind,
shortHelpString, longHelpString)
示例8: _ToolBar_InsertSimpleTool
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def _ToolBar_InsertSimpleTool(self, pos, toolId, bitmap, shortHelpString="", longHelpString="", isToggle=0):
"""
Old style method to insert a tool in the toolbar.
"""
kind = wx.ITEM_NORMAL
if isToggle: kind = wx.ITEM_CHECK
return self.InsertTool(pos, toolId, '', bitmap, wx.NullBitmap, kind,
shortHelpString, longHelpString)
示例9: add_toolitem
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def add_toolitem(
self, name, group, position, image_file, description, toggle):
before, group = self._add_to_group(group, name, position)
idx = self.GetToolPos(before.Id)
if image_file:
bmp = _load_bitmap(image_file)
kind = wx.ITEM_NORMAL if not toggle else wx.ITEM_CHECK
tool = self.InsertTool(idx, -1, name, bmp, wx.NullBitmap, kind,
description or "")
else:
size = (self.GetTextExtent(name)[0]+10, -1)
if toggle:
control = wx.ToggleButton(self, -1, name, size=size)
else:
control = wx.Button(self, -1, name, size=size)
tool = self.InsertControl(idx, control, label=name)
self.Realize()
def handler(event):
self.trigger_tool(name)
if image_file:
self.Bind(wx.EVT_TOOL, handler, tool)
else:
control.Bind(wx.EVT_LEFT_DOWN, handler)
self._toolitems.setdefault(name, [])
group.insert(position, tool)
self._toolitems[name].append((tool, handler))
示例10: add_toolitem
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def add_toolitem(
self, name, group, position, image_file, description, toggle):
before, group = self._add_to_group(group, name, position)
idx = self.GetToolPos(before.Id)
if image_file:
bmp = _load_bitmap(image_file)
kind = wx.ITEM_NORMAL if not toggle else wx.ITEM_CHECK
tool = self.InsertTool(idx, -1, name, bmp, wx.NullBitmap, kind,
description or "")
else:
size = (self.GetTextExtent(name)[0]+10, -1)
if toggle:
control = wx.ToggleButton(self, -1, name, size=size)
else:
control = wx.Button(self, -1, name, size=size)
tool = self.InsertControl(idx, control, label=name)
self.Realize()
def handler(event):
self.trigger_tool(name)
if image_file:
self.Bind(wx.EVT_TOOL, handler, tool)
else:
control.Bind(wx.EVT_LEFT_DOWN, handler)
self._last = tool
self._toolitems.setdefault(name, [])
group.insert(position, tool)
self._toolitems[name].append((tool, handler))
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: MyToolBar.__init__
kwds["style"] = kwds.get("style", 0)
wx.ToolBar.__init__(self, *args, **kwds)
self.AddTool(wx.ID_UP, "UpDown", wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, "Up or Down", "Up or Down")
self.Realize()
# end wxGlade
# end of class MyToolBar
示例12: _init_coll_DisplayMenu_Items
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def _init_coll_DisplayMenu_Items(self, parent):
AppendMenu(parent, help='', id=wx.ID_REFRESH,
kind=wx.ITEM_NORMAL, text=_(u'Refresh') + '\tCTRL+R')
if self.EnableDebug:
AppendMenu(parent, help='', id=wx.ID_CLEAR,
kind=wx.ITEM_NORMAL, text=_(u'Clear Errors') + '\tCTRL+K')
parent.AppendSeparator()
zoommenu = wx.Menu(title='')
parent.AppendMenu(wx.ID_ZOOM_FIT, _("Zoom"), zoommenu)
for idx, value in enumerate(ZOOM_FACTORS):
new_id = wx.NewId()
AppendMenu(zoommenu, help='', id=new_id,
kind=wx.ITEM_RADIO, text=str(int(round(value * 100))) + "%")
self.Bind(wx.EVT_MENU, self.GenerateZoomFunction(idx), id=new_id)
parent.AppendSeparator()
AppendMenu(parent, help='', id=ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE,
kind=wx.ITEM_NORMAL, text=_(u'Switch perspective') + '\tF12')
self.Bind(wx.EVT_MENU, self.SwitchPerspective, id=ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE)
AppendMenu(parent, help='', id=ID_PLCOPENEDITORDISPLAYMENUFULLSCREEN,
kind=wx.ITEM_NORMAL, text=_(u'Full screen') + '\tShift-F12')
self.Bind(wx.EVT_MENU, self.SwitchFullScrMode, id=ID_PLCOPENEDITORDISPLAYMENUFULLSCREEN)
AppendMenu(parent, help='', id=ID_PLCOPENEDITORDISPLAYMENURESETPERSPECTIVE,
kind=wx.ITEM_NORMAL, text=_(u'Reset Perspective'))
self.Bind(wx.EVT_MENU, self.OnResetPerspective, id=ID_PLCOPENEDITORDISPLAYMENURESETPERSPECTIVE)
self.Bind(wx.EVT_MENU, self.OnRefreshMenu, id=wx.ID_REFRESH)
# alpha sort of project items
sort_alpha_id = wx.NewId()
self.alphasortMenuItem = AppendMenu(parent, help='', id=sort_alpha_id,
kind=wx.ITEM_CHECK, text=_(u'Sort Alpha') )
self.Bind(wx.EVT_MENU, self.ToggleSortAlpha, id=sort_alpha_id)
if self.EnableDebug:
self.Bind(wx.EVT_MENU, self.OnClearErrorsMenu, id=wx.ID_CLEAR)
示例13: _AddTool
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def _AddTool(parent, wx_ids, text, bmp, tooltip_text):
if text in ['Pan', 'Zoom']:
kind = wx.ITEM_CHECK
else:
kind = wx.ITEM_NORMAL
if is_phoenix:
add_tool = parent.AddTool
else:
add_tool = parent.DoAddTool
if not is_phoenix or wx_version >= str("4.0.0b2"):
# NOTE: when support for Phoenix prior to 4.0.0b2 is dropped then
# all that is needed is this clause, and the if and else clause can
# be removed.
kwargs = dict(label=text,
bitmap=bmp,
bmpDisabled=wx.NullBitmap,
shortHelp=text,
longHelp=tooltip_text,
kind=kind)
else:
kwargs = dict(label=text,
bitmap=bmp,
bmpDisabled=wx.NullBitmap,
shortHelpString=text,
longHelpString=tooltip_text,
kind=kind)
return add_tool(wx_ids[text], **kwargs)
示例14: create_toolbar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def create_toolbar(self):
# new, open, save, generate, add, delete, re-do, Layout 1, 2, 3, pin, help
# insert slot/page?
# Layout: Alt + 1,2,3
self.toolbar = tb = wx.ToolBar(self, -1)
self.SetToolBar(tb)
size = (21,21)
add = functools.partial(self._add_label_tool, tb, size)
t = add( wx.ID_NEW, "New", wx.ART_NEW, wx.ITEM_NORMAL, "Open a new file (Ctrl+N)")
self.Bind(wx.EVT_TOOL, self.new_app, t)
t = add( wx.ID_OPEN, "Open", wx.ART_FILE_OPEN, wx.ITEM_NORMAL, "Open a file (Ctrl+O)")
self.Bind(wx.EVT_TOOL, self.open_app, t)
t = add( wx.ID_SAVE, "Save", wx.ART_FILE_SAVE, wx.ITEM_NORMAL, "Save file (Ctrl+S)")
self.Bind(wx.EVT_TOOL, self.save_app, t)
if config.debugging and hasattr(wx, "ART_PLUS"):
t = add( wx.ID_SAVE, "Add", wx.ART_PLUS, wx.ITEM_NORMAL, "Add widget (Ctrl+A)")
t.Enable(False)
# XXX switch between wx.ART_DELETE for filled slots and wx.ART_MINUS for empty slots
t = add( wx.ID_SAVE, "Remove", wx.ART_MINUS, wx.ITEM_NORMAL, "Add widget (Ctrl+A)")
t.Enable(False)
tb.AddSeparator()
self._tool_redo = t = add( wx.ID_SAVE, "Re-do", wx.ART_REDO, wx.ITEM_NORMAL, "Re-do (Ctrl+Y)" )
t.Enable(False)
self._tool_repeat = t = add( wx.ID_SAVE, "Repeat", wx.ART_REDO, wx.ITEM_NORMAL, "Repeat (Ctrl+R)" )
t.Enable(False)
tb.AddSeparator()
t = add(-1, "Generate Code", wx.ART_EXECUTABLE_FILE, wx.ITEM_NORMAL, "Generate Code (Ctrl+G)" )
self.Bind(wx.EVT_TOOL, lambda event: common.root.generate_code(), t)
tb.AddSeparator()
t1 = add(-1, "Layout 1", "layout1.xpm", wx.ITEM_RADIO, "Switch layout: Tree",
"Switch layout: Palette and Properties left, Tree right")
self.Bind(wx.EVT_TOOL, lambda event: self.switch_layout(0), t1)
t2 = add(-1, "Layout 2", "layout2.xpm", wx.ITEM_RADIO,"Switch layout: Properties",
"Switch layout: Palette and Tree top, Properties bottom")
self.Bind(wx.EVT_TOOL, lambda event: self.switch_layout(1), t2)
t3 = add(-1, "Layout 3", "layout3.xpm", wx.ITEM_RADIO, "Switch layout: narrow",
"Switch layout: Palette, Tree and Properties on top of each other")
self.Bind(wx.EVT_TOOL, lambda event: self.switch_layout(2), t3)
self._layout_tools = [t1,t2,t3]
tb.AddSeparator()
t = add(-1, "Pin Design Window", "pin_design.xpm", wx.ITEM_CHECK, "Pin Design Window",
"Pin Design Window to stay on top")
self.Bind(wx.EVT_TOOL, lambda event: self.pin_design_window(), t)
self._t_pin_design_window = t
tb.AddSeparator()
t = add(wx.ID_HELP, "Help", wx.ART_HELP_BOOK, wx.ITEM_NORMAL, "Show manual (F1)")
self.Bind(wx.EVT_TOOL, self.show_manual, t)
self.toolbar.Realize()
示例15: _add_parent_popup_menu_items
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ITEM_CHECK [as 别名]
def _add_parent_popup_menu_items(self, menu, item, widget):
# called from managed widget items' _create_popup_menu method
# rows/cols if inside a grid sizer
if "rows" in self.PROPERTIES:
row, col = self._get_row_col(item.index)
i = misc.append_menu_item(menu, -1, _('Insert Row before') )
misc.bind_menu_item_after(widget, i, self.insert_row, item.index)
i = misc.append_menu_item(menu, -1, _('Insert Column before') )
misc.bind_menu_item_after(widget, i, self.insert_col, item.index)
if row==self.rows-1:
# last row
i = misc.append_menu_item(menu, -1, _('Add Row') )
misc.bind_menu_item_after(widget, i, self.insert_row, -1)
if col==self.cols-1:
# last col
i = misc.append_menu_item(menu, -1, _('Add Column') )
misc.bind_menu_item_after(widget, i, self.insert_col, -1)
if "growable_rows" in self.PROPERTIES:
i = misc.append_menu_item(menu, -1, _('Make Row growable'), kind=wx.ITEM_CHECK )
i.Check(row in self.growable_rows)
misc.bind_menu_item_after(widget, i, self.make_growable, "row", row)
i = misc.append_menu_item(menu, -1, _('Make Column growable'), kind=wx.ITEM_CHECK )
i.Check(col in self.growable_cols)
misc.bind_menu_item_after(widget, i, self.make_growable, "col", col)
if "rows" in self.PROPERTIES:
menu.AppendSeparator()
if self._can_add_insert_slots():
# slots
i = misc.append_menu_item(menu, -1, _('Insert Slot before\tCtrl+I') )
misc.bind_menu_item_after(widget, i, self.insert_slot, item.index)
i = misc.append_menu_item(menu, -1, _('Insert Slots before...\tCtrl+Shift+I') )
misc.bind_menu_item_after(widget, i, self.insert_slot, item.index, True)
if item.index==len(self.children)-1: # last slot -> allow to add
i = misc.append_menu_item(menu, -1, _('Add Slot\tCtrl+A') )
misc.bind_menu_item_after(widget, i, self.add_slot)
i = misc.append_menu_item(menu, -1, _('Add Slots...\tCtrl+Shift+A') )
misc.bind_menu_item_after(widget, i, self.add_slot, True)
menu.AppendSeparator()
####################################################################################################################