本文整理汇总了Python中wx.SP_ARROW_KEYS属性的典型用法代码示例。如果您正苦于以下问题:Python wx.SP_ARROW_KEYS属性的具体用法?Python wx.SP_ARROW_KEYS怎么用?Python wx.SP_ARROW_KEYS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.SP_ARROW_KEYS属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_spin_ctrl
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SP_ARROW_KEYS [as 别名]
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
示例2: _create_spin_ctrl
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SP_ARROW_KEYS [as 别名]
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)
示例3: create_editor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SP_ARROW_KEYS [as 别名]
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
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SP_ARROW_KEYS [as 别名]
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()