Rather than having to directly type a number into a gtk.entry.Entry,
gtk.spin_button.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, with the bonus that it can be checked to ensure it is in a
given range.
Note that gtk.spin_button.SpinButton will by default make its entry large enough
to accommodate the lower and upper bounds of the adjustment. If this
is not desired, the automatic sizing can be turned off by explicitly
setting property@Gtk.Editable:width-chars to a value != -1.
gtk.spin_button.SpinButtons main CSS node has the name spinbutton. It creates subnodes
for the entry and the two buttons, with these names. The button nodes have
the style classes .up and .down. The gtk.text.Text subnodes (if present) are put
below the text node. The orientation of the spin button is reflected in
the .vertical or .horizontal style class on the main node.
A gtk.spin_button.SpinButton is an ideal way to allow the user to set the value of some attribute.
Rather than having to directly type a number into a gtk.entry.Entry, gtk.spin_button.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, with the bonus that it can be checked to ensure it is in a given range.
The main properties of a gtk.spin_button.SpinButton are through an adjustment. See the gtk.adjustment.Adjustment documentation for more details about an adjustment's properties.
Note that gtk.spin_button.SpinButton will by default make its entry large enough to accommodate the lower and upper bounds of the adjustment. If this is not desired, the automatic sizing can be turned off by explicitly setting property@Gtk.Editable:width-chars to a value != -1.
Using a GtkSpinButton to get an integer
Using a GtkSpinButton to get a floating point value
CSS nodes
gtk.spin_button.SpinButtons main CSS node has the name spinbutton. It creates subnodes for the entry and the two buttons, with these names. The button nodes have the style classes .up and .down. The gtk.text.Text subnodes (if present) are put below the text node. The orientation of the spin button is reflected in the .vertical or .horizontal style class on the main node.
Accessibility
gtk.spin_button.SpinButton uses the gtk.types.AccessibleRole.SpinButton role.