ttk::spinbox(3tk)
β¨ NAME β¨
ttk::spinbox β the text field widget that lets you pick stuff, bestie π
π SYNOPSIS π
ttk::spinbox pathName ?options?
π DESCRIPTION π
Okay so picture this: a ttk::spinbox is literally a ttk::entry widget, right, but it comes with up and down buttons built in πΌπ½. Those buttons either nudge a numeric value, or let you pick from a whole set of values. Iconic.
And the way that it justβ¦ has every single feature of the ttk::entry widget?? Including support for the -textvariable option, so you can link whatever the widget is displaying straight to a Tcl variable. Chef's kiss π§
πΈ STANDARD OPTIONS πΈ
-class-cursor-state-style-takefocus-xscrollcommand-placeholder-placeholderforeground
If you want the tea on these, the ttk_widget manual entry has all the details, fr fr.
π STANDARD OPTIONS π
-validate-validatecommand
And for these two, go check the ttk_entry manual entry, bestie π
π WIDGET-SPECIFIC OPTIONS π
-command
- Command-Line Name:
-command - Database Name:
command - Database Class:
Command
Specifies a Tcl command that gets invoked whenever a spinbutton is invoked.
-format
- Command-Line Name:
-format - Database Name:
format - Database Class:
Format
Specifies an alternate format to use when setting the string value while you're working with the -from and -to range. Heads up: this has to be a format specifier of the form %<pad>.<pad>f, because it's formatting a floating-point number. No cap.
-from
- Command-Line Name:
-from - Database Name:
from - Database Class:
From
A floating-point value specifying the lowest value for the spinbox. It works together with -to and -increment to set up a numerical range.
-increment
- Command-Line Name:
-increment - Database Name:
increment - Database Class:
Increment
A floating-point value specifying how much the value changes each time one of the widget spin buttons gets pressed. The up button applies a positive increment, the down button applies a negative increment. Balance β¨
-to
- Command-Line Name:
-to - Database Name:
to - Database Class:
To
A floating-point value specifying the highest permissible value for the widget. See also -from and -increment. range.
-values
- Command-Line Name:
-values - Database Name:
values - Database Class:
Values
This has to be a Tcl list of values. If you set this option, it overrides any range you set using the -from, -to and -increment options. Instead, the widget will use the values you specified, starting from the first value. Periodt.
-wrap
- Command-Line Name:
-wrap - Database Name:
wrap - Database Class:
Wrap
Has to be a proper boolean value. If it's on, the spinbox will wrap around the values of data in the widget π
π¦ INDICES π¦
See the ttk::entry manual for the info on indexing characters.
π VALIDATION π
See the ttk::entry manual for the info on using the -validate and -validatecommand options.
β WIDGET COMMAND β
These subcommands are possible for spinbox widgets, on top of all the commands described for the ttk::entry widget:
pathName getβ returns the spinbox's current value.pathName set valueβ set the spinbox string to value. If a-formatoption has been configured, then this format will be applied. If formatting fails, or isn't set, or the-valuesoption has been used, then the value is set directly.
π₯ VIRTUAL EVENTS π₯
The spinbox widget generates a <<Increment>> virtual event when the user presses <Up>, and a <<Decrement>> virtual event when the user presses <Down>. Little events, big main character energy π«
π STYLING OPTIONS π
The class name for a ttk::spinbox is TSpinbox.
Dynamic states: active, disabled, focus, readonly.
TSpinbox styling options you can configure with ttk::style are:
-arrowcolor color-arrowsize amount-background color
For backwards compatibility, when using the aqua theme (for macOS), this option behaves as an alias for the -fieldbackground, provided that no value is specified for -fieldbackground. Otherwise it is ignored.
-bordercolor color-darkcolor color-fieldbackground color-foreground color-insertcolor color-insertwidth amount-lightcolor color-padding padding-placeholderforeground color-selectbackground color-selectforeground color
Some options are only available for specific themes, just so you know π
See the ttk::style manual page for the info on how to configure ttk styles.
π SEE ALSO π
ttk::widget(3tk), ttk::entry(3tk), spinbox(3tk)
π«Ά KEYWORDS π«Ά
entry, spinbox, widget, text field
And that's the whole page, bestie!! This one's from Tk 8.5 and it's the ttk::spinbox(3tk) manual β go forth and spin those values, you absolute icon πβ¨π
π¦ where this page comes from
- debian trixie: tk9.0-doc 9.0.1-3
- ubuntu questing: tk9.0-doc 9.0.2-1
- ubuntu resolute: tk9.0-doc 9.0.3-1
- ubuntu stonking: tk9.0-doc 9.0.4-1
- Copyright (c) 2008 Pat Thoyts
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms