Table Of Contents

Previous topic

Slider

Next topic

SpinCtrl

This Page

phoenix_title SpinButton

A SpinButton has two small up and down (or left and right) arrow buttons.

It is often used next to a text control for increment and decrementing a value. Portable programs should try to use SpinCtrl instead as SpinButton is not implemented for all platforms but SpinCtrl is as it degenerates to a simple TextCtrl on such platforms.

styles Window Styles

This class supports the following styles:

  • SP_HORIZONTAL: Specifies a horizontal spin button (note that this style is not supported in wxGTK).
  • SP_VERTICAL: Specifies a vertical spin button.
  • SP_ARROW_KEYS: The user can use arrow keys to change the value.
  • SP_WRAP: The value wraps at the minimum and maximum.

events Events Emitted by this Class

Handlers bound for the following event types will receive a SpinEvent parameter.

  • EVT_SPIN: Generated whenever an arrow is pressed.
  • EVT_SPIN_UP: Generated when left/up arrow is pressed.
  • EVT_SPIN_DOWN: Generated when right/down arrow is pressed.

Note that if you handle both SPIN and UP or DOWN events, you will be notified about each of them twice: first the UP/DOWN event will be received and then, if it wasn’t vetoed, the SPIN event will be sent.

Note

the range supported by this control (and SpinCtrl) depends on the platform but is at least -0x8000 to 0x7fff . Under GTK and Win32 with sufficiently new version of comctrl32.dll (at least 4.71 is required, 5.80 is recommended) the full 32 bit range is supported.

See also

SpinCtrl


class_hierarchy Inheritance Diagram

Inheritance diagram for class SpinButton

Inheritance diagram of SpinButton


appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


method_summary Methods Summary

__init__ Default constructor.
Create Scrollbar creation function called by the spin button constructor.
GetMax Returns the maximum permissible value.
GetMin Returns the minimum permissible value.
GetRange  
GetValue Returns the current spin button value.
SetMax  
SetMin  
SetRange Sets the range of the spin button.
SetValue Sets the value of the spin button.

property_summary Properties Summary

Max See GetMax and SetMax
Min See GetMin and SetMin
Range See GetRange
Value See GetValue and SetValue

api Class API



class SpinButton(Control)

A SpinButton has two small up and down (or left and right) arrow buttons.

Possible constructors:

SpinButton()

SpinButton(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize,
           style=SP_VERTICAL, name="spinButton")

Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.



__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=SP_VERTICAL, name=”spinButton”)

Constructor, creating and showing a spin button.

Parameters:
  • parent (Window) – Parent window. Must not be None.
  • id (int) – Window identifier. The value ID_ANY indicates a default value.
  • pos (Point) – Window position. If DefaultPosition is specified then a default position is chosen.
  • size (Size) – Window size. If DefaultSize is specified then a default size is chosen.
  • style (long) – Window style. See SpinButton class description.
  • name (string) – Window name.

See also

Create





Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=SP_VERTICAL, name="wxSpinButton")

Scrollbar creation function called by the spin button constructor.

See SpinButton for details.

Parameters:
  • parent (Window) –
  • id (int) –
  • pos (Point) –
  • size (Size) –
  • style (long) –
  • name (string) –
Return type:

bool



GetMax(self)

Returns the maximum permissible value.

Return type:int

See also

SetRange



GetMin(self)

Returns the minimum permissible value.

Return type:int

See also

SetRange



GetRange(self)


GetValue(self)

Returns the current spin button value.

Return type:int

See also

SetValue



SetMax(self, maxVal)


SetMin(self, minVal)


SetRange(self, min, max)

Sets the range of the spin button.

Parameters:
  • min (int) – The minimum value for the spin button.
  • max (int) – The maximum value for the spin button.

See also

GetMin , GetMax



SetValue(self, value)

Sets the value of the spin button.

Parameters:value (int) – The value for the spin button.

Properties



Max

See GetMax and SetMax



Min

See GetMin and SetMin



Range

See GetRange



Value

See GetValue and SetValue