wx.SpinCtrl

Inheritance diagram for wx.SpinCtrl:



Description

wx.SpinCtrl combines wx.TextCtrl and wx.SpinButton in one control.

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 sent then if the value is different from the last value sent


Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


Properties Summary

Class API

Methods

__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


GetMax()

Gets maximal allowable value.


Returns:

int


GetMin()

Gets minimal allowable value.


Returns:

int


GetValue()

Gets the value of the spin control.


Returns:

int


SetRange(minVal, maxVal)

Sets range of allowable values.

Parameters:

  • minVal (int)
  • maxVal (int)

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.


SetValue(value)

Sets the value of the spin control.

Parameters:

  • value (int)

SetValueString(text)

Sets the value text of the spin control.

Parameters:

  • text (string)

Properties

Max
See GetMax
Min
See GetMin
Value
See GetValue and SetValue