Python wx.ITEM_RADIO Examples
The following are 7
code examples of wx.ITEM_RADIO().
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: toolbar.py From wxGlade with MIT License | 6 votes |
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()
Example #2
Source File: Viewer.py From OpenPLC_Editor with GNU General Public License v3.0 | 6 votes |
def AddBlockPinMenuItems(self, menu, connector): no_modifier = self.AppendItem(menu, _(u'No modifier'), self.OnNoModifierMenu, kind=wx.ITEM_RADIO) negated = self.AppendItem(menu, _(u'Negated'), self.OnNegatedMenu, kind=wx.ITEM_RADIO) rising_edge = self.AppendItem(menu, _(u'Rising Edge'), self.OnRisingEdgeMenu, kind=wx.ITEM_RADIO) falling_edge = self.AppendItem(menu, _(u'Falling Edge'), self.OnFallingEdgeMenu, kind=wx.ITEM_RADIO) not_a_function = self.Controler.GetEditedElementType( self.TagName, self.Debug) != "function" rising_edge.Enable(not_a_function) falling_edge.Enable(not_a_function) if connector.IsNegated(): negated.Check(True) elif connector.GetEdge() == "rising": rising_edge.Check(True) elif connector.GetEdge() == "falling": falling_edge.Check(True) else: no_modifier.Check(True) # Add Alignment Menu items to the given menu
Example #3
Source File: runsnake.py From pyFileFixity with MIT License | 5 votes |
def ConfigureViewTypeChoices( self, event=None ): """Configure the set of View types in the toolbar (and menus)""" self.viewTypeTool.SetItems( getattr( self.loader, 'ROOTS', [] )) if self.loader and self.viewType in self.loader.ROOTS: self.viewTypeTool.SetSelection( self.loader.ROOTS.index( self.viewType )) # configure the menu with the available choices... def chooser( typ ): def Callback( event ): if typ != self.viewType: self.viewType = typ self.OnRootView( event ) return Callback # Clear all previous items for item in self.viewTypeMenu.GetMenuItems(): self.viewTypeMenu.DeleteItem( item ) if self.loader and self.loader.ROOTS: for root in self.loader.ROOTS: item = wx.MenuItem( self.viewTypeMenu, -1, root.title(), _("View hierarchy by %(name)s")%{ 'name': root.title(), }, kind=wx.ITEM_RADIO, ) item.SetCheckable( True ) self.viewTypeMenu.AppendItem( item ) item.Check( root == self.viewType ) wx.EVT_MENU( self, item.GetId(), chooser( root ))
Example #4
Source File: Viewer.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def PopupVariableMenu(self): menu = wx.Menu(title='') variable_type = self.SelectedElement.GetType() for type_label, vtype in [(_("Input"), INPUT), (_("Output"), OUTPUT), (_("InOut"), INOUT)]: item = self.AppendItem(menu, type_label, self.GetChangeVariableTypeMenuFunction(vtype), kind=wx.ITEM_RADIO) if vtype == variable_type: item.Check(True) menu.AppendSeparator() self.AddDefaultMenuItems(menu, block=True) self.Editor.PopupMenu(menu) menu.Destroy()
Example #5
Source File: Viewer.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def PopupConnectionMenu(self): menu = wx.Menu(title='') connection_type = self.SelectedElement.GetType() for type_label, ctype in [(_("Connector"), CONNECTOR), (_("Continuation"), CONTINUATION)]: item = self.AppendItem(menu, type_label, self.GetChangeConnectionTypeMenuFunction(ctype), kind=wx.ITEM_RADIO) if ctype == connection_type: item.Check(True) menu.AppendSeparator() self.AddDefaultMenuItems(menu, block=True) self.Editor.PopupMenu(menu) menu.Destroy()
Example #6
Source File: IDEFrame.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
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)
Example #7
Source File: main.py From wxGlade with MIT License | 4 votes |
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()