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


Python wx.EVT_TOGGLEBUTTON屬性代碼示例

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


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

示例1: add_experiments_buttons

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import EVT_TOGGLEBUTTON [as 別名]
def add_experiments_buttons(self):
        n = flex.max(self.parent.reflections_input["id"])
        if n <= 0:
            self.expt_btn = None
            return

        box = wx.BoxSizer(wx.VERTICAL)
        self.panel_sizer.Add(box)
        label = wx.StaticText(self, -1, "Experiment ids:")
        box.Add(label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.expt_btn = SegmentedToggleControl(self, style=SEGBTN_HORIZONTAL)
        for i in range(-1, n + 1):
            self.expt_btn.AddSegment(str(i))
            if (
                self.settings.experiment_ids is not None
                and i in self.settings.experiment_ids
            ):
                self.expt_btn.SetValue(i + 1, True)

        self.expt_btn.Realize()
        self.Bind(wx.EVT_TOGGLEBUTTON, self.OnChangeSettings, self.expt_btn)
        box.Add(self.expt_btn, 0, wx.ALL, 5) 
開發者ID:dials,項目名稱:dials,代碼行數:25,代碼來源:viewer.py

示例2: __add_bindings

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import EVT_TOGGLEBUTTON [as 別名]
def __add_bindings(self):
        # file_save_ctrl
        self.fsc = control.FileChooserCtrl(self)
        self.Bind(wx.EVT_BUTTON, self.fsc.load_file, self.file_open_button)
        self.Bind(wx.EVT_BUTTON, self.fsc.save_file, self.save_button)

        # record_button_ctrl
        self.rbc = control.RecordCtrl()
        self.Bind(wx.EVT_TOGGLEBUTTON, self.rbc.action, self.record_button)

        # play_button_ctrl
        pbc = control.PlayCtrl()
        self.Bind(wx.EVT_TOGGLEBUTTON, pbc.action, self.play_button)

        # compile_button_ctrl
        self.Bind(wx.EVT_BUTTON, control.CompileCtrl.compile, self.compile_button)

        # help_button_ctrl
        self.Bind(wx.EVT_BUTTON, control.HelpCtrl.action, self.help_button)

        # settings_button_ctrl
        self.Bind(wx.EVT_BUTTON, self.on_settings_click, self.settings_button)

        self.Bind(wx.EVT_CLOSE, self.on_close_dialog)

        self.panel.Bind(wx.EVT_KEY_UP, self.on_key_press) 
開發者ID:RMPR,項目名稱:atbswp,代碼行數:28,代碼來源:gui.py

示例3: create_widget

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import EVT_TOGGLEBUTTON [as 別名]
def create_widget(self):
        self.widget = wx.ToggleButton(self.parent_window.widget, self.id, self.label)
        self.widget.SetValue(self.value)
        self.widget.Bind(wx.EVT_TOGGLEBUTTON, self.on_set_focus, id=self.id)
        BitmapMixin._set_preview_bitmaps(self) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:7,代碼來源:toggle_button.py

示例4: FinishSetup

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import EVT_TOGGLEBUTTON [as 別名]
def FinishSetup(self):
        self.shown = True
        if self.lines:
            self.AddGrid(self.lines, *self.sizerProps)
        spaceSizer = wx.BoxSizer(wx.HORIZONTAL)
        spaceSizer.Add((2, 2))
        spaceSizer.Add(self.sizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 3)
        spaceSizer.Add((4, 4))
        self.SetSizerAndFit(spaceSizer)

        #self.dialog.FinishSetup()
        def OnEvent(dummyEvent):
            self.SetIsDirty()
        self.Bind(wx.EVT_CHECKBOX, OnEvent)
        self.Bind(wx.EVT_BUTTON, OnEvent)
        self.Bind(wx.EVT_CHOICE, OnEvent)
        self.Bind(wx.EVT_TOGGLEBUTTON, OnEvent)
        self.Bind(wx.EVT_TEXT, OnEvent)
        self.Bind(wx.EVT_RADIOBOX, OnEvent)
        self.Bind(wx.EVT_RADIOBUTTON, OnEvent)
        self.Bind(wx.EVT_TREE_SEL_CHANGED, OnEvent)
        self.Bind(wx.EVT_DATE_CHANGED, OnEvent)
        self.Bind(eg.EVT_VALUE_CHANGED, OnEvent)
        self.Bind(wx.EVT_CHECKLISTBOX, OnEvent)
        self.Bind(wx.EVT_SCROLL, OnEvent)
        self.Bind(wx.EVT_LISTBOX, OnEvent) 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:28,代碼來源:ConfigPanel.py

示例5: make_object_button

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import EVT_TOGGLEBUTTON [as 別名]
def make_object_button(widget, icon_path, toplevel=False, tip=None):
    """Creates a button for the widgets toolbar.

    Function used by the various widget modules to add a button to the widgets toolbar.

    Icons with a relative path will be loaded from config.icon_path.

    widget: (name of) the widget the button will add to the app 
    icon_path: Path to the icon_path used for the button
    toplevel: True if the widget is a toplevel object (frame, dialog)
    tip: Tool tip to display

    return: The newly created wxBitmapButton instance"""
    if not config.use_gui: return None
    import wx
    import misc
    from tree import WidgetTree

    if not os.path.isabs(icon_path):
        icon_path = os.path.join(config.icons_path, icon_path)
    bmp = misc.get_xpm_bitmap(icon_path)
    label = widget.replace('Edit', '')
    if compat.version < (3,0):
        # old wx version: use BitmapButton
        tmp = wx.BitmapButton(palette, -1, bmp, size=(31,31))
        if not toplevel:
            tmp.Bind(wx.EVT_BUTTON, add_object)
        else:
            tmp.Bind(wx.EVT_BUTTON, add_toplevel_object)
    else:
        # for more recent versions, we support config options to display icons and/or labels
        if not toplevel:
            if not config.preferences.show_palette_labels:
                # icons only -> set size
                tmp = wx.ToggleButton(palette, -1, size=(31,31), name=label)
            else:
                tmp = wx.ToggleButton(palette, -1, label, name=label )
            tmp.Bind(wx.EVT_TOGGLEBUTTON, add_object)
        else:
            if not config.preferences.show_palette_labels:
                tmp = wx.Button(palette, -1, size=(31,31), name=label)
            else:
                tmp = wx.Button(palette, -1, label, name=label )
            tmp.Bind(wx.EVT_BUTTON, add_toplevel_object)
        if config.preferences.show_palette_icons:
            tmp.SetBitmap( bmp )
    refs[tmp.GetId()] = widget
    if not tip:
        tip = _('Add a %s') % label
    tmp.SetToolTip(wx.ToolTip(tip))

    WidgetTree.images[widget] = icon_path

    return tmp 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:56,代碼來源:common.py


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