A Ttk (i.e. theme-able) scrollbar widget.
HaO 2019-04-29: The class name is tricky. The pure name TScrollbar may be used to modify the original style:
ttk::style configure TScrollbar -relief raised
Nevertheless, for any other purpose,the name Horizontal.TScrollbar or Vertical.TScrollbar is used.
To diplay the layout of the widget:
% ttk::style layout Vertical.TScrollbar
Vertical.Scrollbar.trough -sticky ns -children {
Vertical.Scrollbar.uparrow -side top -sticky {}
Vertical.Scrollbar.downarrow -side bottom -sticky {}
Vertical.Scrollbar.thumb -sticky nswe -unit 1 -children {
Vertical.Scrollbar.grip -sticky {}}}A custom stlye may be defined as follows:
ttk::style configure My.Vertical.TScrollbar -troughcolor yellow
pack [ttk::scrollbar .s -style My.Vertical.TScrollbar -orient vertical -command ".t yview"]\
-fill y -expand true -side right
pack [text .t -yscrollcommand ".s set"]\
-side left -fill both -expand true
.t insert 1.0 [string repeat 1\n 100]The following styling options are supported: The description is for a vertical slider. There are 5 regions named here: upper arrow, upper trough, thumb, lower trough, lower arrow.
| option | Description | Present in styles (incomplete) |
|---|---|---|
| -arrowcolor | arrow background color | clam |
| -arrowsize | arrows width and height and thus width of the widget | alt, clam, default, native, classic |
| -background | ? | clam |
| -bordercolor | ? | clam |
| -borderwidth | ? | classic, default |
| -darkcolor | color of the frames of each element | clam |
| -gripcount | number of vertical lines on the thumb | clam |
| -groovewidth | ? | alt, vista, winnative, xpnative |
| -lightcolor | ? | clam |
| -orient | probably automatic, should not be changed | all |
| -sliderlength | No visual effect | clam, default |
| -troughcolor | trough color | alt, clam, classic, default, vista, winnative, xpnative |
| -troughborderwidth | trough width | alt, vista, winnative, xpnative |
| -troughrelief | trough relief | alt, classic, default, vista, winnative, xpnative |
The styling options may be listed by :
% foreach styleCur [ttk::style theme names] {
> ttk::style theme use $styleCur
> puts "$styleCur: [lsort [ttk::style element options Vertical.TScrollbar.trough]]"
> }
winnative: -groovewidth -orient -troughborderwidth -troughcolor -troughrelief
clam: -arrowcolor -arrowsize -background -bordercolor -darkcolor -gripcount -lightcolor -orient -sliderlength -troughcolor
alt: -groovewidth -orient -troughborderwidth -troughcolor -troughrelief
default: -borderwidth -troughcolor -troughrelief
classic: -borderwidth -troughcolor -troughrelief
vista: -groovewidth -orient -troughborderwidth -troughcolor -troughrelief
xpnative: -groovewidth -orient -troughborderwidth -troughcolor -troughreliefAnybody may complete the upper table...