SpinnerEntry
Bases: Field
A spinner entry field widget with built-in spin controls.
SpinnerEntry extends the Field widget to provide a spinbox input that can handle both predefined text values and numeric ranges. The widget includes built-in up/down arrow buttons and supports keyboard/mouse wheel interaction.
Events
<<Change>>: Fired when value changes after commit.<<Input>>: Fired on each keystroke.<<Valid>>: Fired when validation passes.<<Invalid>>: Fired when validation fails.
Attributes:
| Name | Type | Description |
|---|---|---|
entry_widget |
SpinnerEntryPart
|
The underlying spinbox entry widget. |
label_widget |
Label
|
The label widget above the entry. |
message_widget |
Label
|
The message label widget below the entry. |
addons |
dict[str, Widget]
|
Dictionary of inserted addon widgets by name. |
variable |
Variable
|
Tkinter Variable linked to entry text. |
signal |
Signal
|
Signal object for reactive updates. |
values
property
values: List[str]
Get the list of valid values (text mode only).
__init__
__init__(
master: Master = None,
value: Union[int, float, str] = "",
label: str = None,
message: str = None,
values: List[str] = None,
minvalue: Union[int, float] = None,
maxvalue: Union[int, float] = None,
increment: Union[int, float] = 1,
wrap: bool = False,
**kwargs: Unpack[FieldOptions],
)
Initialize a SpinnerEntry widget.
Creates a spinner entry field with optional label, validation, and either a predefined list of values or a numeric range. The widget includes built-in up/down arrows for cycling through values or adjusting numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
master
|
Master
|
Parent widget. If None, uses the default root window. |
None
|
value
|
Union[int, float, str]
|
Initial value to display. Can be string, integer, or float depending on whether using text values or numeric range. Default is empty string. |
''
|
label
|
str
|
Optional label text to display above the entry field. If required=True, an asterisk (*) is automatically appended. |
None
|
message
|
str
|
Optional message text to display below the entry field. Used for hints or help text. Replaced by validation errors when validation fails. |
None
|
values
|
List[str]
|
List of valid string values for the spinner. If provided, the spinner cycles through these values. Mutually exclusive with minvalue/maxvalue/increment. Example: ['Low', 'Medium', 'High'] |
None
|
minvalue
|
Union[int, float]
|
Minimum numeric value (inclusive). Only used for numeric spinners. If provided along with 'maxvalue', creates a numeric range spinner. |
None
|
maxvalue
|
Union[int, float]
|
Maximum numeric value (inclusive). Only used for numeric spinners. If provided along with 'minvalue', creates a numeric range spinner. |
None
|
increment
|
Union[int, float]
|
Step size for increment/decrement in numeric mode. Default is 1. Only applies when using minvalue/maxvalue. |
1
|
wrap
|
bool
|
If True, values wrap around at boundaries. Default is False. |
False
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
value_format |
str
|
ICU format pattern for parsing/formatting. |
locale |
str
|
Locale identifier for formatting (e.g., 'en_US'). |
required |
bool
|
If True, field cannot be empty. |
color |
str
|
Color token for the focus ring and active border. |
bootstyle |
str
|
DEPRECATED - Use |
allow_blank |
bool
|
If True, empty input is allowed. |
cursor |
str
|
Cursor style when hovering. |
font |
str
|
Font for text display. |
foreground |
str
|
Text color. |
initial_focus |
bool
|
If True, widget receives focus on creation. |
justify |
str
|
Text alignment. |
show_message |
bool
|
If True, displays message area. |
padding |
str
|
Padding around entry widget. |
takefocus |
bool
|
If True, widget accepts Tab focus. |
textvariable |
Variable
|
Tkinter Variable to link with text. |
textsignal |
Signal
|
Signal object for reactive updates. |
width |
int
|
Width in characters. |
Note
Use either 'values' (for text mode) OR 'minvalue/maxvalue' (for numeric mode), not both. If both are provided, 'values' takes precedence.