SpinBox (hwx.gui)#
- class SpinBox(**kwds)#
Bases:
Widget
A SpinBox Widget.
SpinBox allows to choose a value by clicking the up/down buttons or pressing up/down on the keyboard to increase/decrease the displayed value.
The upper and lower bounds are defined by the min and max properties. The user can also type the value manually. The SpinBox supports integer values and invokes the callback command every time the value is changed.
# Name
Type
property
property
property
property
property
# Name
Description
setValue
(self, value)Sets the specified value after converting it into an integer.
Example
from hwx import gui # This method is called whenever the spin box value is changed. # It modifies the text of the output label def onChanged(): output.text = spin.value # Create a SpinBox with displayed text = prefix + value + suffix spin = gui.SpinBox(prefix='Use ', value=5, suffix=' samples', min=0, # minimun allowed value max=10, # maximum allowed value command=onChanged, ) # Create a label to show the spin box value output = gui.Label(spin.value) frame = gui.HFrame(spin, 10, output) show(frame)
- property min#
The minimum integer value.
- property max#
The maximum integer value.
- property step#
The value by which SpinBox is increased/decreased when you click the arrows.
- property prefix#
The text that appears before the int.
- property suffix#
The text that appears after the int.
- setValue(value)#
Sets the specified value after converting it into an integer.
- Parameters:
value (int) – The numeric value to be set for the SpinBox.