Python wx.EVT_TOGGLEBUTTON Examples
The following are 5
code examples of wx.EVT_TOGGLEBUTTON().
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: viewer.py From dials with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #2
Source File: gui.py From atbswp with GNU General Public License v3.0 | 5 votes |
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)
Example #3
Source File: toggle_button.py From wxGlade with MIT License | 5 votes |
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)
Example #4
Source File: ConfigPanel.py From EventGhost with GNU General Public License v2.0 | 5 votes |
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)
Example #5
Source File: common.py From wxGlade with MIT License | 4 votes |
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