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


Python wx.ITEM_RADIO屬性代碼示例

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


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

示例1: _set_tools

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

示例2: AddBlockPinMenuItems

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ITEM_RADIO [as 別名]
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 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:23,代碼來源:Viewer.py

示例3: ConfigureViewTypeChoices

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

示例4: PopupVariableMenu

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ITEM_RADIO [as 別名]
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() 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:17,代碼來源:Viewer.py

示例5: PopupConnectionMenu

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ITEM_RADIO [as 別名]
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() 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:16,代碼來源:Viewer.py

示例6: _init_coll_DisplayMenu_Items

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

示例7: create_toolbar

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


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