gtk.SpinButtonretrieve an integer or floating-point number from the
user.Synopsisgtk.SpinButtongtk.Entrygtk.SpinButtonadjustmentNoneclimb_rate0.0digits0configureadjustmentclimb_ratedigitsset_adjustmentadjustmentget_adjustmentset_digitsdigitsget_digitsset_incrementssteppageget_incrementsset_rangeminmaxget_rangeget_valueget_value_as_intset_valuevalueset_update_policypolicyget_update_policyset_numericnumericget_numericspindirectionincrement1.0set_wrapwrapget_wrapset_snap_to_tickssnap_to_ticksget_snap_to_ticksupdateAncestry+-- gobject.GObject
+-- gtk.Object
+-- gtk.Widget
+-- gtk.Entry (implements gtk.Editable, gtk.CellEditable)
+-- gtk.SpinButton
Implemented Interfacesgtk.SpinButton
implements
gtk.Buildablegtk.SpinButton Propertiesgtk.Object Propertiesgtk.Widget Propertiesgtk.Entry Properties
"adjustment"Read-WriteThe adjustment that holds the value of the
spinbutton"climb-rate"Read-WriteThe acceleration rate when you hold down a
button"digits"Read-WriteThe number of decimal places to display"numeric"Read-WriteIf True, non-numeric characters
should be ignored"snap-to-ticks"Read-WriteIf True, erroneous values are
automatically changed to a spin button's nearest step increment"update-policy"Read-Writeeither gtk.UPDATE_ALWAYS (the spin
button should update always), or gtk.UPDATE_IF_VALID the
spin button should update only when the value is legal)"value"Read-Writethe current value"wrap"Read-WriteIf True, a spin button should wrap
upon reaching its limits
"shadow-type"Readthe shadow type of the spinbutton - one of:
gtk.SHADOW_NONE, gtk.SHADOW_IN,
gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN
or gtk.SHADOW_ETCHED_OUT
gtk.SpinButton Signal Prototypesgobject.GObject Signal Prototypesgtk.Object Signal Prototypesgtk.Widget Signal Prototypesgtk.Entry Signal Prototypesgtk.Editable Signal Prototypesgtk.CellEditable Signal Prototypes"change-value"callbackspinbuttonscrolltypeuser_param1..."input"callbackspinbuttonvalue_ptruser_param1..."output"callbackspinbuttonuser_param1..."value-changed"callbackspinbuttonuser_param1..."wrappedcallbackspinbuttonuser_param1...DescriptionA gtk.SpinButton
is a subclass of gtk.Entry that
provides a way for a user to set the value of some numeric attribute within
a predefined range. Rather than having to directly type a number into a
gtk.Entry, a
gtk.SpinButton
allows the user to click on one of two arrows to increment or decrement the
displayed value. A value can still be typed in and validated. A gtk.SpinButton
uses a gtk.Adjustment
to specify the range and value of interest. See the gtk.Adjustment
section for more details about an adjustment's properties.Constructorgtk.SpinButtonadjustmentNoneclimb_rate0.0digits0adjustment :a gtk.Adjustment
or None to create a new adjustmentclimb_rate :the acceleration factordigits :the number of decimal places to
displayReturns :a new gtk.SpinButton
widgetCreates a new gtk.SpinButton
widget using the gtk.Adjustment
specified by adjustment, the acceleration factor
specified by climb_rate and displaying the number of
decimals specified by digits. If
adjustment is None or is not
specified a new gtk.Adjustment
will be created. If climb_rate is not specified it
defaults to 0.0. If digits is not specified it
defaults to 0.Methodsgtk.SpinButton.configureconfigureadjustmentclimb_ratedigitsadjustment :a gtk.Adjustment
or None to create a new adjustmentclimb_rate :the acceleration factordigits :the number of decimal places to
displayThe configure() method changes the
properties of an existing spin button by associating the gtk.Adjustment
specified by adjustment, setting the acceleration
rate to the c value specified by climb_rate and
setting the number of decimal places to display to the value specified by
digits. If adjustment is
None a new gtk.Adjustment
will be created. gtk.SpinButton.set_adjustmentset_adjustmentadjustmentadjustment :a gtk.Adjustment
to replace the existing adjustmentThe set_adjustment() method sets the
"adjustment" property to the value specified by
adjustment replacing the current adjustment object
associated with the spinbutton.gtk.SpinButton.get_adjustmentget_adjustmentReturns :the gtk.Adjustment
object associated with the spinbuttonThe get_adjustment() method returns the
value of the "adjustment" property.gtk.SpinButton.set_digitsset_digitsdigitsdigits :the number of decimal places to be displayed
for the spin button's valueThe set_digits() method sets the
"digits" property to the value specified by digits.
The value of "digits" determines the number of decimal places (up to 20
digits) to be displayed by the spinbutton.gtk.SpinButton.get_digitsget_digitsReturns :the current number of decimal places to be
displayedThe get_digits() method returns the
value of the "digits" property. The value of "digits" determines the number
of decimal places the spinbutton displays. See the set_digits()
method for more detail.gtk.SpinButton.set_incrementsset_incrementssteppagestep :increment applied for each
left mousebutton press.page :increment applied for each
middle mousebutton press.The set_increments() method sets the
step_increment and page_increment
attributes of the gtk.Adjustment
associated with the spinbutton to the values specified by
step and page respectively.
These affect how quickly the value changes when the spin button's arrows are
activated.gtk.SpinButton.get_incrementsget_incrementsReturns :a tuple containing the step and page
incrementsThe get_increments() method returns a
tuple containing the values of the step_increment and
page_increment attributes of the gtk.Adjustment
associated with the spinbutton. See the set_increments()
method for more detail.gtk.SpinButton.set_rangeset_rangeminmaxmin :the minimum allowable
valuemax :the maximum allowable
valueThe set_range() method sets the minimum
and maximum allowable values for spinbutton by setting the
lower and upper attributes of the
associated gtk.Adjustment
to the values of min and max
respectively.gtk.SpinButton.get_rangeget_rangeReturns :a tuple containing the minimum and maximum
allowed valuesThe get_range() method returns a tuple
containing the range allowed for the spinbutton. See the set_range()
method for more detail.gtk.SpinButton.get_valueget_valueReturns :the value of the
spin_buttonThe get_value() method returns the
value of the "value" property of the spinbutton (really the
value attribute of the associated gtk.Adjustment).gtk.SpinButton.get_value_as_intget_value_as_intReturns :the value of the spinbutton as an
integerThe get_value_as_int() method returns
the value of the spinbutton represented as an integer.gtk.SpinButton.set_valueset_valuevaluevalue :the new valueThe set_value() method sets the value
of the "value" property to the value specified by
value (sets the value attribute of
the associated gtk.Adjustment.gtk.SpinButton.set_update_policyset_update_policypolicypolicy :the new update policyThe set_update_policy() method sets the
"update-policy" property to the value of policy. The
value of policy is either of:gtk.UPDATE_ALWAYSthe value is always displayed.gtk.UPDATE_IF_VALIDthe value is only displayed if it is valid within the
bounds of the spinbutton's gtk.Adjustment.gtk.SpinButton.get_update_policyget_update_policyReturns :the current update policyThe get_update_policy() method returns
the value of the "update-policy" property that determines the update
behavior of a spin button. See the set_update_policy()
method for more detail.gtk.SpinButton.set_numericset_numericnumericnumeric :a flag indicating if only numeric entry is
allowed.The set_numeric() method sets the value
of the "numeric" property to the value of numeric. If
numeric is True only numeric text
can be typed into the spin button.gtk.SpinButton.get_numericget_numericReturns :True if only numeric text
can be enteredThe get_numeric() method returns the
value of the "numeric" preoperty. See the set_numeric()
method for more detail.gtk.SpinButton.spinspindirectionincrement1.0direction :the direction to spin.increment :the step increment to apply in the specified
direction.The spin() method increments or
decrements a spin button's value in the direction specified by
direction with a step size specified by
increment. The value of
increment is only used if direction is
gtk.SPIN_USER_DEFINED. The value of
direction must be one of:gtk.SPIN_STEP_FORWARDforward by step_incrementgtk.SPIN_STEP_BACKWARDbackward by step_incrementgtk.SPIN_PAGE_FORWARDforward by step_incrementgtk.SPIN_PAGE_BACKWARDbackward by step_incrementgtk.SPIN_HOMEmove to minimum valuegtk.SPIN_ENDmove to maximum valuegtk.SPIN_USER_DEFINEDadd increment to the
valuegtk.SpinButton.set_wrapset_wrapwrapwrap :if True wrapping is
performed.The set_wrap() method sets the "wrap"
property to the value of wrap. If
wrap is True the spin button value
wraps around to the opposite limit when the upper or lower limit of the
range is exceeded.gtk.SpinButton.get_wrapget_wrapReturns :True if the spin button
wrapsThe get_wrap() method returns the value
of the "wrap" property. If the value of "wrap" is True
the spinbutton's value wraps around to the opposite limit when the upper or
lower limit of the range is exceeded. See the set_wrap()
method.gtk.SpinButton.set_snap_to_ticksset_snap_to_tickssnap_to_tickssnap_to_ticks :if True invalid values
should be corrected.The set_snap_to_ticks() method sets the
"snap-to-ticks" property to the value of
snap_to_ticks. If
snap_to_ticks is True values are
corrected to the nearest step increment when a spin button is activated
after providing an invalid value.gtk.SpinButton.get_snap_to_ticksget_snap_to_ticksReturns :True if values are snapped
to the nearest step.The get_snap_to_ticks() method returns
the value of the "snap-to-ticks" property. If the value of "snap-to-ticks"
is True the input values are corrected to the nearest
step. See the set_snap_to_ticks()
method.gtk.SpinButton.updateupdateThe update() method manually forces an
update of the spin button.SignalsThe "change-value" gtk.SpinButton Signalcallbackspinbuttonscrolltypeuser_param1...spinbutton :the spinbutton that received the
signalscrolltype :the scrolltype:
gtk.SCROLL_STEP_UP,
gtk.SCROLL_STEP_DOWN,
gtk.SCROLL_PAGE_UP, gtk.SCROLL_PAGE_DOWN,
gtk.SCROLL_START or
gtk.SCROLL_ENDuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "change-value" signal is emitted when the spinbutton value is
changed by keyboard action using the Up Arrow, Down Arrow,
Page Up, Page
Down, ControlPage Up
or ControlPage
Down keys.The "input" gtk.SpinButton Signalcallbackspinbuttonvalue_ptruser_param1...spinbutton :the spinbutton that received the
signalvalue_ptr :a pointer to the valueuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the input value was
retrieved and handled; False if not handled and
-1 if an error occurred during processing.The "input" signal is emitted when the value changes. The
value_ptr is a GPointer to the value that cannot be accessed from PyGTK.
This signal cannot be handled in PyGTK.The "output" gtk.SpinButton Signalcallbackspinbuttonuser_param1...spinbutton :the spinbutton that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if no further
processing is required.The "output" signal is emitted when the spinbutton display value
is changed either by setting a new value or changing the digits and on
realizing the widget. Returns True if the handler
successfully set the text and no further processing is required.The "value-changed" gtk.SpinButton Signalcallbackspinbuttonuser_param1...spinbutton :the spinbutton that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "value-changed" signal is emitted when any of the settings (i.e. value, digits) that change the display of the spinbutton are changed.The "wrapped" gtk.SpinButton Signalcallbackspinbuttonuser_param1...spinbutton :the object which received the signal
the object which received the signal.user_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if any)This signal is available in GTK+ 2.10 and above.The "wrapped" signal is emitted right after the spinbutton wraps
from its maximum to minimum value or vice-versa.