*********** wx.SpinCtrl *********** Inheritance diagram for `wx.SpinCtrl`: | .. inheritance-diagram:: wx.SpinCtrl | Description =========== `wx.SpinCtrl` combines `wx.TextCtrl `_ and `wx.SpinButton `_ in one control. .. seealso:: `wx.SpinButton `_, `wx.Control `_ Derived From ^^^^^^^^^^^^^ * `wx.Control `_ * `wx.Window `_ * `wx.EvtHandler `_ * `wx.Object `_ Window Styles ^^^^^^^^^^^^^ ================================================== ================================================== Window Style Description ================================================== ================================================== ``wx.SP_ARROW_KEYS`` The user can use arrow keys to change the value. ``wx.SP_WRAP`` The value wraps at the minimum and maximum. ================================================== ================================================== Event Handling ^^^^^^^^^^^^^^ ================================================== ================================================== Event Name Description ================================================== ================================================== wx.EVT_SPINCTRL(id, func) Generated whenever the numeric value of the spinctrl is updated ================================================== ================================================== .. note:: You may also use the `wx.SpinButton `_ event macros, however the corresponding events will not be generated under all platforms. Finally, if the user modifies the text in the edit part of the spin control directly, the ``wx.EVT_TEXT`` is generated, like for the `wx.TextCtrl `_. When the use enters text into the text area, the text is not validated until the control loses focus (e.g. by using the ``TAB`` key). The value is then adjusted to the range and a `wx.SpinEvent <../Events/wx.SpinEvent.html>`_ sent then if the value is different from the last value sent | Control Appearance ^^^^^^^^^^^^^^^^^^ | .. figure:: ../images/wxWidgets/wxmsw/spinctrl.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: ../images/wxWidgets/wxmac/spinctrl.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: ../images/wxWidgets/wxgtk/spinctrl.png :alt: wxGTK :figclass: floatcenter **wxGTK** | Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `GetMax <#GetMax>`_ * `GetMin <#GetMin>`_ * `GetValue <#GetValue>`_ * `SetRange <#SetRange>`_ * `SetSelection <#SetSelection>`_ * `SetValue <#SetValue>`_ * `SetValueString <#SetValueString>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `Max <#Max>`_ * `Min <#Min>`_ * `Value <#Value>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(parent, id=-1, value="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.SP_ARROW_KEYS, min=0, max=100, initial=0, name=wx.SpinCtrlNameStr) Constructor, creating and showing a spin control. **Parameters:** * `parent` (`wx.Window `_) * `id` (int) * `value` (string) * `pos` (`wx.Point `_) * `size` (`wx.Size `_) * `style` (long) * `min` (int) * `max` (int) * `initial` (int) * `name` (string) | **Returns:** `wx.SpinCtrl `_ -------- .. method:: GetMax() Gets maximal allowable value. | **Returns:** `int` -------- .. method:: GetMin() Gets minimal allowable value. | **Returns:** `int` -------- .. method:: GetValue() Gets the value of the spin control. | **Returns:** `int` -------- .. method:: SetRange(minVal, maxVal) Sets range of allowable values. **Parameters:** * `minVal` (int) * `maxVal` (int) -------- .. method:: SetSelection(from, to) Select the text in the text part of the control between positions `from` (inclusive) and `to` (exclusive). This is similar to `wx.TextCtrl.SetSelection `_. **Parameters:** * `from` (long) * `to` (long) .. note:: this is currently only implemented for Windows and generic versions of the control. -------- .. method:: SetValue(value) Sets the value of the spin control. **Parameters:** * `value` (int) -------- .. method:: SetValueString(text) Sets the value text of the spin control. **Parameters:** * `text` (string) -------- Properties ^^^^^^^^^^ .. attribute:: Max See `GetMax <#GetMax>`_ .. attribute:: Min See `GetMin <#GetMin>`_ .. attribute:: Value See `GetValue <#GetValue>`_ and `SetValue <#SetValue>`_