Python wx.SP_ARROW_KEYS Examples
The following are 5
code examples of wx.SP_ARROW_KEYS().
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: new_properties.py From wxGlade with MIT License | 5 votes |
def _create_spin_ctrl(self, panel): style = wx.TE_PROCESS_ENTER | wx.SP_ARROW_KEYS self.spin = wx.SpinCtrl( panel, -1, style=style, min=self.val_range[0], max=self.val_range[1] ) val = self.value if not val: self.spin.SetValue(1) # needed for GTK to display a '0' self.spin.SetValue(val)
Example #2
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def create_spin_ctrl(self, panel): style = wx.TE_PROCESS_ENTER | wx.SP_ARROW_KEYS spin = wx.SpinCtrlDouble( panel, -1, style=style, min=self.val_range[0], max=self.val_range[1] ) spin.SetDigits(3) spin.SetValue(self.value) range_ = abs(self.val_range[1]-self.val_range[0]) if range_<=1.0: spin.SetIncrement(0.1) else: spin.SetIncrement(1.0) return spin
Example #3
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def create_editor(self, panel, sizer): if not _is_gridbag(self.owner.parent): return max_rows, max_cols = self.owner.parent.check_span_range(self.owner.index, *self.value) hsizer = wx.BoxSizer(wx.HORIZONTAL) # label self.label_ctrl = label = self._get_label(self._find_label(), panel) hsizer.Add(label, 0, wx.ALL | wx.ALIGN_CENTER, 3) # checkbox, if applicable self.enabler = None style = wx.TE_PROCESS_ENTER | wx.SP_ARROW_KEYS self.rowspin = wx.SpinCtrl( panel, -1, style=style, min=1, max=max_rows) # don't set size here as the self.colspin = wx.SpinCtrl( panel, -1, style=style, min=1, max=max_cols) # combination withe SetSelection fails val = self.value self.rowspin.SetValue(val and val[0] or 1) self.colspin.SetValue(val and val[1] or 1) self.rowspin.Enable(max_rows!=1) self.colspin.Enable(max_cols!=1) self.rowspin.SetSelection(-1, -1) self.colspin.SetSelection(-1, -1) # layout of the controls / sizers; when adding the spins, set min size as well hsizer.Add(wx.StaticText(panel, -1, _("Rows:")), 1, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 3) si = hsizer.Add(self.rowspin, 5, wx.ALL | wx.ALIGN_CENTER, 3).SetMinSize( (30,-1) ) hsizer.Add(wx.StaticText(panel, -1, _("Cols:")), 1, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 3) hsizer.Add(self.colspin, 5, wx.ALL | wx.ALIGN_CENTER, 3).SetMinSize( (30,-1) ) sizer.Add(hsizer, 0, wx.EXPAND) self._set_tooltip(label, self.rowspin, self.colspin) self.rowspin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) # by default, the value is only set when the focus is lost self.colspin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) self.rowspin.Bind(wx.EVT_SET_FOCUS, self.on_focus) self.colspin.Bind(wx.EVT_SET_FOCUS, self.on_focus) if self.immediate: self.rowspin.Bind(wx.EVT_SPINCTRL, self.on_spin) self.rowspin.Bind(wx.EVT_TEXT_ENTER, self.on_spin) # we want the enter key (see style above) self.colspin.Bind(wx.EVT_SPINCTRL, self.on_spin) self.colspin.Bind(wx.EVT_TEXT_ENTER, self.on_spin) self.editing = True
Example #4
Source File: new_properties.py From wxGlade with MIT License | 4 votes |
def create_spin_ctrl(self, panel): style = wx.TE_PROCESS_ENTER | wx.SP_ARROW_KEYS spin = wx.SpinCtrl( panel, -1, style=style, min=self.val_range[0], max=self.val_range[1] ) val = self.value if not val: spin.SetValue(1) # needed for GTK to display a '0' spin.SetValue(val) spin.SetSelection(-1,-1) return spin
Example #5
Source File: LDPowerRailDialog.py From OpenPLC_Editor with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent, controller, tagname): """ Constructor @param parent: Parent wx.Window of dialog for modal @param controller: Reference to project controller @param tagname: Tagname of project POU edited """ BlockPreviewDialog.__init__(self, parent, controller, tagname, title=_('Power Rail Properties')) # Init common sizers self._init_sizers(2, 0, 5, None, 2, 1) # Create label for connection type type_label = wx.StaticText(self, label=_('Type:')) self.LeftGridSizer.AddWindow(type_label, flag=wx.GROW) # Create radio buttons for selecting power rail type self.TypeRadioButtons = {} first = True for type, label in [(LEFTRAIL, _('Left PowerRail')), (RIGHTRAIL, _('Right PowerRail'))]: radio_button = wx.RadioButton(self, label=label, style=(wx.RB_GROUP if first else 0)) radio_button.SetValue(first) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button) self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW) self.TypeRadioButtons[type] = radio_button first = False # Create label for power rail pin number pin_number_label = wx.StaticText(self, label=_('Pin number:')) self.LeftGridSizer.AddWindow(pin_number_label, flag=wx.GROW) # Create spin control for defining power rail pin number self.PinNumber = wx.SpinCtrl(self, min=1, max=50, style=wx.SP_ARROW_KEYS) self.PinNumber.SetValue(1) self.Bind(wx.EVT_SPINCTRL, self.OnPinNumberChanged, self.PinNumber) self.LeftGridSizer.AddWindow(self.PinNumber, flag=wx.GROW) # Add preview panel and associated label to sizers self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW) self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW) # Add buttons sizer to sizers self.MainSizer.AddSizer( self.ButtonSizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) self.Fit() # Left Power Rail radio button is default control having keyboard focus self.TypeRadioButtons[LEFTRAIL].SetFocus()