Python wx.EVT_CHECKBOX Examples
The following are 30
code examples of wx.EVT_CHECKBOX().
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: g.gui.tangible.py From grass-tangible-landscape with GNU General Public License v2.0 | 6 votes |
def BindModelProperties(self): self.btnCalibrateTilt.Bind(wx.EVT_BUTTON, self.scaniface.Calibrate) self.btnCalibrateExtent.Bind(wx.EVT_BUTTON, self.scaniface.CalibrateModelBBox) # model parameters self.elevInput.Bind(wx.EVT_TEXT, self.OnModelProperties) self.regionInput.Bind(wx.EVT_TEXT, self.OnModelProperties) self.zexag.Bind(wx.EVT_TEXT, self.OnModelProperties) self.rotate.Bind(wx.EVT_SPINCTRL, self.OnModelProperties) self.rotate.Bind(wx.EVT_TEXT, self.OnModelProperties) self.numscans.Bind(wx.EVT_SPINCTRL, self.OnModelProperties) self.numscans.Bind(wx.EVT_TEXT, self.OnModelProperties) self.interpolate.Bind(wx.EVT_CHECKBOX, self.OnModelProperties) self.smooth.Bind(wx.EVT_TEXT, self.OnModelProperties) self.resolution.Bind(wx.EVT_TEXT, self.OnModelProperties) self.trim_tolerance.Bind(wx.EVT_TEXT, self.OnModelProperties) for each in 'nsewtb': self.trim[each].Bind(wx.EVT_TEXT, self.OnModelProperties)
Example #2
Source File: DialogUtils.py From kicad_mmccoo with Apache License 2.0 | 6 votes |
def AddSelector(self, name, binding=None): if (binding == None): binding = self.OnButton if (not self.singleton): rb = wx.CheckBox(self, label=name) rb.Bind(wx.EVT_CHECKBOX, binding) elif (len(self.boxes) == 0): # boxes gets updated in Add rb = wx.RadioButton(self.scrolled, label=name, style=wx.RB_GROUP) rb.Bind(wx.EVT_RADIOBUTTON, binding) self.SendSelectorEvent(rb) else: rb = wx.RadioButton(self.scrolled, label=name) rb.Bind(wx.EVT_RADIOBUTTON, binding) self.Add(rb)
Example #3
Source File: new_properties.py From wxGlade with MIT License | 6 votes |
def create_editor(self, panel, sizer): self._choices = [] tooltips = self._create_tooltip_text() for box_label in self.styles.keys(): static_box = wx.StaticBox(panel, -1, box_label, style=wx.FULL_REPAINT_ON_RESIZE) box_sizer = wx.StaticBoxSizer(static_box, wx.VERTICAL) for style in self.styles[box_label]: checkbox = wx.CheckBox(panel, -1, style) if style in tooltips: compat.SetToolTip(checkbox, tooltips[style]) self._choices.append(checkbox) box_sizer.Add(checkbox) sizer.Add(box_sizer, 0, wx.ALL | wx.EXPAND, 5) self.update_display(True) for checkbox in self._choices: if checkbox is None: continue # derived classes may not use all options, e.g. obsolete ones checkbox.Bind(wx.EVT_CHECKBOX, self.on_checkbox)
Example #4
Source File: new_properties.py From wxGlade with MIT License | 6 votes |
def create_editor(self, panel, sizer): label_text = self._find_label() self.checkbox = wx.CheckBox(panel, -1, '', name=label_text) self._display_value() self.label_ctrl = label = self._get_label(label_text, panel, name=label_text) if config.preferences.use_checkboxes_workaround: size = self.checkbox.GetSize() self.checkbox.SetLabel(label_text) self.checkbox.SetMaxSize(size) hsizer = wx.BoxSizer(wx.HORIZONTAL) #hsizer.Add(label, 2, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3) hsizer.Add(label, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3) #hsizer.SetItemMinSize(0, config.label_initial_width, -1) #hsizer.AddSpacer(20) hsizer.Add(self.checkbox, 0, wx.ALIGN_LEFT | wx.ALL, 3) hsizer.AddStretchSpacer(5) sizer.Add(hsizer, 0, wx.EXPAND) self._set_tooltip(label, self.checkbox) self.checkbox.Bind(wx.EVT_CHECKBOX, self.on_change_val) self.editing = True
Example #5
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 6 votes |
def get_summary_widgets(self, summary_panel): """Return a list of summary widgets suitable for sizer.AddMany.""" self.summary_panel = summary_panel self.summary_name = wx.StaticText(summary_panel, -1, self.name) self.summary_name.Bind(wx.EVT_LEFT_UP, self.show_this_panel) self.summary_status = wx.StaticText(summary_panel, -1, STR_STOPPED) self.summary_shares_accepted = wx.StaticText(summary_panel, -1, "0") self.summary_shares_invalid = wx.StaticText(summary_panel, -1, "0") self.summary_start = wx.Button(summary_panel, -1, self.get_start_stop_state(), style=wx.BU_EXACTFIT) self.summary_start.Bind(wx.EVT_BUTTON, self.toggle_mining) self.summary_autostart = wx.CheckBox(summary_panel, -1) self.summary_autostart.Bind(wx.EVT_CHECKBOX, self.toggle_autostart) self.summary_autostart.SetValue(self.autostart) return [ (self.summary_name, 0, wx.ALIGN_CENTER_HORIZONTAL), (self.summary_status, 0, wx.ALIGN_CENTER_HORIZONTAL, 0), (self.summary_shares_accepted, 0, wx.ALIGN_CENTER_HORIZONTAL, 0), (self.summary_shares_invalid, 0, wx.ALIGN_CENTER_HORIZONTAL, 0), (self.summary_start, 0, wx.ALIGN_CENTER, 0), (self.summary_autostart, 0, wx.ALIGN_CENTER, 0) ]
Example #6
Source File: Posix.py From admin4 with Apache License 2.0 | 5 votes |
def __init__(self, dlg, notebook, resname=None): SpecificEntry.__init__(self, dlg, notebook, resname) self.Bind("Expires", wx.EVT_CHECKBOX, self.OnExpire) self.Bind("GenerateUid", self.OnGenerateUid) self.Bind("GenerateGid", self.OnGenerateGid)
Example #7
Source File: RotarySettings.py From meerk40t with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: RotarySettings.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((222, 347)) self.checkbox_rotary = wx.CheckBox(self, wx.ID_ANY, _("Rotary")) self.spin_rotary_scaley = wx.SpinCtrlDouble(self, wx.ID_ANY, "1.0", min=0.0, max=5.0) self.spin_rotary_scalex = wx.SpinCtrlDouble(self, wx.ID_ANY, "1.0", min=0.0, max=5.0) self.checkbox_rotary_loop = wx.CheckBox(self, wx.ID_ANY, _("Field Loop")) self.spin_rotary_rotation = wx.SpinCtrlDouble(self, wx.ID_ANY, "360.0", min=0.0, max=20000.0) self.checkbox_rotary_roller = wx.CheckBox(self, wx.ID_ANY, _("Uses Roller")) self.spin_rotary_roller_circumference = wx.SpinCtrlDouble(self, wx.ID_ANY, "50.0", min=0.0, max=800.0) self.spin_rotary_object_circumference = wx.SpinCtrlDouble(self, wx.ID_ANY, "50.0", min=0.0, max=800.0) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_CHECKBOX, self.on_check_rotary, self.checkbox_rotary) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_rotary_scale_y, self.spin_rotary_scaley) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_rotary_scale_y, self.spin_rotary_scaley) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_rotary_scale_x, self.spin_rotary_scalex) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_rotary_scale_x, self.spin_rotary_scalex) self.Bind(wx.EVT_CHECKBOX, self.on_check_rotary_loop, self.checkbox_rotary_loop) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_rotation, self.spin_rotary_rotation) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_rotation, self.spin_rotary_rotation) self.Bind(wx.EVT_CHECKBOX, self.on_check_rotary_roller, self.checkbox_rotary_roller) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_rotary_roller_circumference, self.spin_rotary_roller_circumference) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_rotary_roller_circumference, self.spin_rotary_roller_circumference) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_rotary_object_circumference, self.spin_rotary_object_circumference) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_rotary_object_circumference, self.spin_rotary_object_circumference) # end wxGlade self.Bind(wx.EVT_CLOSE, self.on_close, self)
Example #8
Source File: EngraveProperty.py From meerk40t with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: EngraveProperty.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((305, 216)) self.spin_speed_set = wx.SpinCtrlDouble(self, wx.ID_ANY, "20.0", min=0.0, max=240.0) self.spin_power_set = wx.SpinCtrlDouble(self, wx.ID_ANY, "1000.0", min=0.0, max=1000.0) self.checkbox_custom_d_ratio = wx.CheckBox(self, wx.ID_ANY, _("Custom D-Ratio")) self.spin_speed_dratio = wx.SpinCtrlDouble(self, wx.ID_ANY, "0.261", min=0.0, max=1.0) self.checkbox_custom_accel = wx.CheckBox(self, wx.ID_ANY, _("Acceleration Override")) self.slider_accel = wx.Slider(self, wx.ID_ANY, 1, 1, 4, style=wx.SL_AUTOTICKS | wx.SL_LABELS) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_TEXT, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_TEXT, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_CHECKBOX, self.on_check_custom_d_ratio, self.checkbox_custom_d_ratio) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_speed_dratio, self.spin_speed_dratio) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_speed_dratio, self.spin_speed_dratio) self.Bind(wx.EVT_TEXT, self.on_spin_speed_dratio, self.spin_speed_dratio) self.Bind(wx.EVT_CHECKBOX, self.on_check_custom_accel, self.checkbox_custom_accel) self.Bind(wx.EVT_COMMAND_SCROLL, self.on_slider_accel, self.slider_accel) self.operation = None self.Bind(wx.EVT_CLOSE, self.on_close, self)
Example #9
Source File: __init__.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, label, main, option_name, initial_value, extra_callback=None): wx.CheckBox.__init__(self, parent, label=label) self.main = main self.option_name = option_name self.option_type = type(initial_value) self.SetValue(bool(initial_value)) self.extra_callback = extra_callback self.Bind(wx.EVT_CHECKBOX, self.callback)
Example #10
Source File: DialogUtils.py From kicad_mmccoo with Apache License 2.0 | 5 votes |
def SendSelectorEvent(self, box): if (isinstance(box, wx.CheckBox)): # I have the feeling that this is the wrong way to trigger # an event. newevent = wx.CommandEvent(wx.EVT_CHECKBOX.evtType[0]) newevent.SetEventObject(box) wx.PostEvent(box, newevent) if (isinstance(box, wx.RadioButton)): newevent = wx.CommandEvent(wx.EVT_RADIOBUTTON.evtType[0]) newevent.SetEventObject(box) wx.PostEvent(box, newevent)
Example #11
Source File: panel.py From admin4 with Apache License 2.0 | 5 votes |
def __init__(self, parent, xxx): wx.Panel.__init__(self, parent, -1) self.xxx = xxx # Register event handlers for id in paramIDs.values(): wx.EVT_CHECKBOX(self, id, self.OnCheckParams) self.checks = {} self.controls = {} # save python objects self.controlName = None
Example #12
Source File: controlcontainer.py From admin4 with Apache License 2.0 | 5 votes |
def _bind(self, ctlName, evt=None, proc=None): if isinstance(ctlName, wx.PyEventBinder): # binding to self ctl=super(wx.Window, self) proc=evt evt=ctlName elif isinstance(ctlName, wx.Window): ctl=ctlName else: ctl=self[ctlName] if not proc: if not isinstance(evt, wx.PyEventBinder): proc=evt evt=None if not proc: proc=self.OnCheck if not evt: if isinstance(ctl, wx.Button): evt=wx.EVT_BUTTON elif isinstance(ctl, wx.CheckBox): evt=wx.EVT_CHECKBOX elif isinstance(ctl, wx.CheckListBox): evt=wx.EVT_CHECKLISTBOX elif isinstance(ctl, wx.RadioButton): evt=wx.EVT_RADIOBUTTON else: evt=wx.EVT_TEXT if isinstance(ctl, wx.ComboBox): ctl.Bind(wx.EVT_COMBOBOX, proc) ctl.Bind(evt, proc)
Example #13
Source File: optionsframe.py From youtube-dl-gui with The Unlicense | 5 votes |
def _on_enable_log(self, event): """Event handler for the wx.EVT_CHECKBOX of the enable_log_checkbox.""" wx.MessageBox(_("In order for the changes to take effect please restart {0}").format(__appname__), _("Restart"), wx.OK | wx.ICON_INFORMATION, self)
Example #14
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def create_editor(self, panel, sizer): if self.val_range is None: self.val_range = (0, 1000) hsizer = wx.BoxSizer(wx.HORIZONTAL) # label label_text = self._find_label() label = self.label_ctrl = self._get_label(label_text, panel) hsizer.Add(label, 0, wx.ALL | wx.ALIGN_CENTER, 3) # checkbox, if applicable self.enabler = None if self.deactivated is not None: self.enabler = wx.CheckBox(panel, -1, '') if config.preferences.use_checkboxes_workaround: size = self.enabler.GetSize() self.enabler.SetLabel("Enable %s"%label_text) self.enabler.SetMaxSize(size) self.enabler.SetValue(not self.deactivated) self.enabler.Bind( wx.EVT_CHECKBOX, lambda event: self.toggle_active(event.IsChecked()) ) hsizer.Add(self.enabler, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT, 3) self.spin = self.create_spin_ctrl(panel) if self.deactivated is not None: self.spin.Enable(not self.deactivated) elif self.blocked or self.readonly: self.spin.Enable(False) # layout of the controls / sizers hsizer.Add(self.spin, 5, wx.ALL | wx.ALIGN_CENTER, 3) sizer.Add(hsizer, 0, wx.EXPAND) self._set_tooltip(label, self.spin, self.enabler) self.spin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) # by default, the value is only set when the focus is lost self.spin.Bind(wx.EVT_SET_FOCUS, self.on_focus) if wx.Platform == '__WXMAC__' or self.immediate: self.spin.Bind(wx.EVT_SPINCTRL, self.on_spin) self.spin.Bind(wx.EVT_TEXT_ENTER, self.on_spin) # we want the enter key (see style above) self.editing = True
Example #15
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def create_editor(self, panel, sizer): self._choices = [] # the checkboxes self._ensure_values() widget_writer = self.owner.widget_writer tooltips = self._create_tooltip_text() static_box = wx.StaticBox(panel, -1, _("Style"), style=wx.FULL_REPAINT_ON_RESIZE) box_sizer = wx.StaticBoxSizer(static_box, wx.VERTICAL) for name, flag_value in zip(self._names, self._values): if name in widget_writer.style_defs: style_def = widget_writer.style_defs[name] else: # a generic style; no description in the class config style_def = config.widget_config["generic_styles"][name] if "obsolete" in style_def or "rename_to" in style_def: self._choices.append(None) continue checkbox = wx.CheckBox(panel, -1, name) if name in tooltips: compat.SetToolTip( checkbox, tooltips[name] ) self._choices.append(checkbox) box_sizer.Add(checkbox) sizer.Add(box_sizer, 0, wx.ALL | wx.EXPAND, 5) self.update_display(True) for checkbox in self._choices: if checkbox is not None: checkbox.Bind(wx.EVT_CHECKBOX, self.on_checkbox)
Example #16
Source File: checkbox.py From wxGlade with MIT License | 5 votes |
def create_widget(self): self.widget = wx.CheckBox(self.parent_window.widget, self.id, self.label) self.widget.SetValue(self.value) def on_checkbox(event): value = 1 if event.IsChecked() else 0 self.properties["checked"].set(value) self.widget.Bind(wx.EVT_CHECKBOX, on_checkbox, id=self.id)
Example #17
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, sep='', res = True): panel = eg.ConfigPanel(self) sepLbl = wx.StaticText(panel,-1,self.plugin.text.sepLabel) sepCtrl = wx.TextCtrl(panel,-1,sep) sepLbl.SetToolTip(wx.ToolTip(self.plugin.text.sepToolTip)) sepCtrl.SetToolTip(wx.ToolTip(self.plugin.text.sepToolTip)) resCtrl = wx.CheckBox(panel, -1, self.plugin.text.resType) resCtrl.SetValue(res) def onResCtrl(evt = None): enable = resCtrl.GetValue() sepCtrl.Enable(enable) sepLbl.Enable(enable) if evt: evt.Skip() resCtrl.Bind(wx.EVT_CHECKBOX, onResCtrl) onResCtrl() mySizer = wx.BoxSizer(wx.HORIZONTAL) panel.sizer.Add(resCtrl, 0, wx.TOP, 30) panel.sizer.Add(mySizer,0,wx.TOP,15) mySizer.Add(sepLbl,0,wx.TOP,3) mySizer.Add((10,1)) mySizer.Add(sepCtrl) while panel.Affirmed(): panel.SetResult( sepCtrl.GetValue(), resCtrl.GetValue() )
Example #18
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, x=0, y=0): text = self.text panel = eg.ConfigPanel() xCheckBox = panel.CheckBox(x is not None, text.text1) xCtrl = panel.SpinIntCtrl(0 if x is None else x, min=-32768, max=32767) xCtrl.Enable(x is not None) yCheckBox = panel.CheckBox(y is not None, text.text3) yCtrl = panel.SpinIntCtrl(0 if y is None else y, min=-32768, max=32767) yCtrl.Enable(y is not None) def HandleXCheckBox(event): xCtrl.Enable(event.IsChecked()) event.Skip() xCheckBox.Bind(wx.EVT_CHECKBOX, HandleXCheckBox) def HandleYCheckBox(event): yCtrl.Enable(event.IsChecked()) event.Skip() yCheckBox.Bind(wx.EVT_CHECKBOX, HandleYCheckBox) panel.AddLine(xCheckBox, xCtrl, text.text2) panel.AddLine(yCheckBox, yCtrl, text.text2) while panel.Affirmed(): panel.SetResult( xCtrl.GetValue() if xCtrl.IsEnabled() else None, yCtrl.GetValue() if yCtrl.IsEnabled() else None, )
Example #19
Source File: StatusBar.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent): wx.StatusBar.__init__(self, parent, -1) self.sizeChanged = False self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_IDLE, self.OnIdle) self.SetFieldsCount(2) self.SetStatusWidths([-1, 40]) self.icons = [ GetInternalBitmap("Tray1"), GetInternalBitmap("Tray3"), GetInternalBitmap("Tray2"), ] self.icon = wx.StaticBitmap(self, -1, self.icons[0], (0, 0), (16, 16)) rect = self.GetFieldRect(0) checkBox = wx.CheckBox(self, -1, eg.text.MainFrame.onlyLogAssigned) self.checkBox = checkBox colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR) checkBox.SetBackgroundColour(colour) self.checkBoxColour = checkBox.GetForegroundColour() checkBox.SetValue(eg.config.onlyLogAssigned) self.SetCheckBoxColour(eg.config.onlyLogAssigned) checkBox.Bind(wx.EVT_CHECKBOX, self.OnCheckBox) checkBox.SetPosition((rect.x + 2, rect.y + 2)) checkBox.SetToolTipString(eg.text.MainFrame.onlyLogAssignedToolTip) eg.Bind("ProcessingChange", self.OnProcessingChange) self.Reposition()
Example #20
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 #21
Source File: optionsframe.py From youtube-dl-gui with The Unlicense | 5 votes |
def _on_shutdown(self, event): """Event handler for the wx.EVT_CHECKBOX of the shutdown_checkbox.""" self.sudo_textctrl.Enable(self.shutdown_checkbox.GetValue())
Example #22
Source File: navigation_toolbar.py From RF-Monitor with GNU General Public License v2.0 | 5 votes |
def __init__(self, canvas, legend): NavigationToolbar2Wx.__init__(self, canvas) self._canvas = canvas self._legend = legend self._autoScale = True if matplotlib.__version__ >= '1.2': panId = self.wx_ids['Pan'] else: panId = self.FindById(self._NTB2_PAN).GetId() self.ToggleTool(panId, True) self.pan() checkLegend = wx.CheckBox(self, label='Legend') checkLegend.SetValue(legend.get_visible()) self.AddControl(checkLegend) self.Bind(wx.EVT_CHECKBOX, self.__on_legend, checkLegend, id) if wx.__version__ >= '2.9.1': self.AddStretchableSpace() else: self.AddSeparator() self._textCursor = wx.StaticText(self, style=wx.ALL | wx.ALIGN_RIGHT) font = self._textCursor.GetFont() if wx.__version__ >= '2.9.1': font.MakeSmaller() font.SetFamily(wx.FONTFAMILY_TELETYPE) self._textCursor.SetFont(font) w, _h = get_text_size(' ' * 18, font) self._textCursor.SetSize((w, -1)) self.AddControl(self._textCursor) self.Realize()
Example #23
Source File: headersdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
def addCheckBox(self, name, parent, sizer, pad): cb = wx.CheckBox(parent, -1, name) wx.EVT_CHECKBOX(self, cb.GetId(), self.OnMisc) sizer.Add(cb, 0, wx.TOP, pad) setattr(self, name.lower() + "Cb", cb)
Example #24
Source File: wx_viewer.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, parent): wx.MiniFrame.__init__( self, parent, -1, title="OpenGL settings", pos=(100, 100), style=wx.CAPTION | wx.CLOSE_BOX | wx.RAISED_BORDER, ) self.parent = parent self.widgets = {} panel = wx.Panel(self, -1) main_sizer = wx.BoxSizer(wx.VERTICAL) fog_box = wx.CheckBox(panel, -1, "Use fog") fog_box.SetValue(parent.flag_show_fog) main_sizer.Add(fog_box, 0, wx.ALL, 5) self.fog_box = fog_box szr = wx.FlexGridSizer(rows=0, cols=2, vgap=5, hgap=5) main_sizer.Add(szr, 0, 0, 0) slab_label = wx.StaticText(panel, -1, "Slab:") slab_slider = wx.Slider( panel, -1, int(parent.slab_scale * 100), minValue=1, maxValue=100 ) szr.Add(slab_label, 0, wx.ALL, 5) szr.Add(slab_slider, 0, wx.ALL, 5) fog_label = wx.StaticText(panel, -1, "Fog scale:") fog_slider = wx.Slider( panel, -1, int(parent.fog_scale_factor * 100), minValue=1, maxValue=100 ) szr.Add(fog_label, 0, wx.ALL, 5) szr.Add(fog_slider, 0, wx.ALL, 5) self.widgets["slab_scale"] = slab_slider self.widgets["fog_scale_factor"] = fog_slider self.SetSizer(main_sizer) main_sizer.Fit(panel) self.Fit() self.Bind(wx.EVT_SLIDER, self.OnUpdate) self.Bind(wx.EVT_CHECKBOX, self.OnUpdate) self.Bind(wx.EVT_CLOSE, self.OnClose)
Example #25
Source File: titlesdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
def addCheckBox(self, name, parent, sizer, pad): cb = wx.CheckBox(parent, -1, name) wx.EVT_CHECKBOX(self, cb.GetId(), self.OnMisc) sizer.Add(cb, 0, wx.TOP, pad) setattr(self, name.lower() + "Cb", cb)
Example #26
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
def addCheckBox(self, name, prefix, parent, sizer, pad): cb = wx.CheckBox(parent, -1, name) wx.EVT_CHECKBOX(self, cb.GetId(), self.OnStyleCb) sizer.Add(cb, 0, wx.TOP, pad) setattr(self, prefix + name + "Cb", cb)
Example #27
Source File: rstbx_frame.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, *args, **kwds): super(ZoomFrame, self).__init__(*args, **kwds) self.settings = self.GetParent().settings self.control_panel = wx.Panel(self) self.panel = rstbx.viewer.display.ZoomView(self, -1) szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) szr.Add(self.control_panel) szr.Add(self.panel, 1, wx.EXPAND) self.numbers_box = wx.CheckBox(self.control_panel, -1, "Show intensity values") txt1 = wx.StaticText(self.control_panel, -1, "Text color:") self.text_color = wx.lib.colourselect.ColourSelect( self.control_panel, colour=(255, 255, 0) ) pszr = wx.BoxSizer(wx.VERTICAL) self.control_panel.SetSizer(pszr) box1 = wx.BoxSizer(wx.HORIZONTAL) pszr.Add(box1) box1.Add(self.numbers_box, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) box1.Add(txt1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) box1.Add(self.text_color, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) box2 = wx.BoxSizer(wx.HORIZONTAL) pszr.Add(box2) txt2 = wx.StaticText(self.control_panel, -1, "Magnification:") self.mag_ctrl = wx.Choice( self.control_panel, -1, choices=["%dx" % x for x in mag_levels] ) self.mag_ctrl.SetSelection(1) box2.Add(txt2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) box2.Add(self.mag_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.Bind(wx.EVT_CLOSE, lambda evt: self.Destroy(), self) self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy) self.Bind(wx.EVT_CHECKBOX, self.OnChangeSettings, self.numbers_box) self.Bind( wx.lib.colourselect.EVT_COLOURSELECT, self.OnChangeSettings, self.text_color ) self.Bind(wx.EVT_CHOICE, self.OnChangeSettings, self.mag_ctrl) szr.Fit(self.panel) self.Fit()
Example #28
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
def addCb(self, descr, sizer, pad): ctrl = wx.CheckBox(self, -1, descr) wx.EVT_CHECKBOX(self, ctrl.GetId(), self.OnMisc) sizer.Add(ctrl, 0, wx.TOP, pad) return ctrl
Example #29
Source File: dialogs.py From NVDARemote with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, id, title): super().__init__(parent, id, title=title) main_sizer = wx.BoxSizer(wx.VERTICAL) # Translators: A checkbox in add-on options dialog to set whether remote server is started when NVDA starts. self.autoconnect = wx.CheckBox(self, wx.ID_ANY, label=_("Auto-connect to control server on startup")) self.autoconnect.Bind(wx.EVT_CHECKBOX, self.on_autoconnect) main_sizer.Add(self.autoconnect) #Translators: Whether or not to use a relay server when autoconnecting self.client_or_server = wx.RadioBox(self, wx.ID_ANY, choices=(_("Use Remote Control Server"), _("Host Control Server")), style=wx.RA_VERTICAL) self.client_or_server.Bind(wx.EVT_RADIOBOX, self.on_client_or_server) self.client_or_server.SetSelection(0) self.client_or_server.Enable(False) main_sizer.Add(self.client_or_server) choices = [_("Allow this machine to be controlled"), _("Control another machine")] self.connection_type = wx.RadioBox(self, wx.ID_ANY, choices=choices, style=wx.RA_VERTICAL) self.connection_type.SetSelection(0) self.connection_type.Enable(False) main_sizer.Add(self.connection_type) main_sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Host:"))) self.host = wx.TextCtrl(self, wx.ID_ANY) self.host.Enable(False) main_sizer.Add(self.host) main_sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Port:"))) self.port = wx.TextCtrl(self, wx.ID_ANY) self.port.Enable(False) main_sizer.Add(self.port) main_sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Key:"))) self.key = wx.TextCtrl(self, wx.ID_ANY) self.key.Enable(False) main_sizer.Add(self.key) buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL) main_sizer.Add(buttons, flag=wx.BOTTOM) main_sizer.Fit(self) self.SetSizer(main_sizer) self.Center(wx.BOTH | WX_CENTER) ok = wx.FindWindowById(wx.ID_OK, self) ok.Bind(wx.EVT_BUTTON, self.on_ok) self.autoconnect.SetFocus()
Example #30
Source File: GoSyncSelectionPage.py From gosync with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, sync_model): wx.Panel.__init__(self, parent, style=wx.RAISED_BORDER) headerFont = wx.Font(11.5, wx.SWISS, wx.NORMAL, wx.NORMAL) self.sync_model = sync_model self.dstc = GoSyncDriveTree(self, pos=(0,0)) self.t1 = wx.StaticText(self, -1, "Choose the directories to sync:", pos=(0,0)) self.t1.SetFont(headerFont) self.cb = wx.CheckBox(self, -1, 'Sync Everything', (10, 10)) self.cb.SetValue(True) self.cb.Disable() self.dstc.Disable() self.cb.Bind(wx.EVT_CHECKBOX, self.SyncSetting) self.Bind(CT.EVT_TREE_ITEM_CHECKED, self.ItemChecked) GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_DONE, self.RefreshTree) GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_STARTED, self.OnUsageCalculationStarted) self.cb.Bind(wx.EVT_CHECKBOX, self.SyncSetting) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.t1, 0, wx.ALL) sizer.Add(self.cb, 0, wx.ALL) sizer.Add(self.dstc, 1, wx.EXPAND,2) self.SetSizer(sizer)