Author: Csaba Nemethi <csaba.nemethi@t-online.de>
State: Draft
Type: Project
Tcl-Version: 9.1
Vote: In progress
Created: 26-Nov-2025
Keywords: spinbox, widget, Tk
Tk-Branch: wide_spinbox
Abstract
This TIP proposes to add a Wide.TSpinbox style to the core,
reusing most parts of the code from the wsb package by the author.
Rationale
The up and down arrows of the Tk core spinbox and ttk::spinbox widgets are so
small that using them is often difficult and error-prone, especially on a touch
screen (e.g., when running AndroWish on a tablet or smartphone). To circumvent
this drawback, the most recent releases of the Tablelist and Scrollutil
packages contain a new package named wsb (wide spinbox), which
implements the Wide.TSpinbox style, whose up and down arrows
are of a more user-friendly size and in which the up arrow is placed to the
right of the down arrow, like in a GtkSpinButton widget.
Harald has recently proposed in the RFE Csaba's wide spinbox for the core to add the
Wide.TSpinbox layout to the core. The same proposal is the
subject of this TIP.
Specification
The TIP proposes to add the Wide.TSpinbox style to the core,
as implemented in the Tk branch wide_spinbox. The definition of the
style takes into account that in the classic theme most
widgets have a solid focus ring:
if {$theme eq "classic"} {
ttk::style layout Wide.TSpinbox {
Entry.highlight -sticky nswe -children {
Entry.field -sticky nswe -children {
WideSpinbox.uparrow -side right -sticky e
WideSpinbox.gap -side right -sticky e
WideSpinbox.downarrow -side right -sticky e
Entry.padding -sticky nswe -children {
Entry.textarea -sticky nsew
}
}
}
}
} else {
ttk::style layout Wide.TSpinbox {
Entry.field -side top -sticky we -children {
WideSpinbox.uparrow -side right -sticky e
WideSpinbox.gap -side right -sticky e
WideSpinbox.downarrow -side right -sticky e
Entry.padding -sticky nswe -children {
Entry.textarea -sticky nsew
}
}
}
}
set padding [ttk::style lookup TEntry -padding]
ttk::style configure Wide.TSpinbox -padding $padding
The elements WideSpinbox.uparrow,
WideSpinbox.gap, and WideSpinbox.downarrow
are created from scaling-aware SVG images. Their sizes depend on the display's
scaling level and Tk's scaling factor given by [tk scaling] at
the time the first themed spinbox widget is created. The colors used in these
images depend on the current theme and appearance, as well as on the state; the
supported states are disabled, active, and
pressed.
Reference Implementation
A ready-to-use reference implementation can be found in the Tk branch wide_spinbox.
Copyright
This document has been placed in the public domain.