本文整理汇总了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)
示例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)
示例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)
示例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)
示例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