Some interactions with the scale cause its value to change by
``large'' increments; this option specifies the size of the
large increments. If specified as 0, the large increments default
to 1/10 the range of the scale.
Specifies the prefix of a perl/Tk callback to invoke whenever the scale's
value is changed via a method.
The actual command consists
of this option followed by a space and a real number indicating the
new value of the scale.
An integer specifying how many significant digits should be retained
when converting the value of the scale to a string.
If the number is less than or equal to zero, then the scale picks
the smallest value that guarantees that every possible slider
position prints as a different string.
A string to display as a label for the scale. For
vertical scales the label is displayed just to the right of the
top end of the scale. For horizontal scales the label is displayed
just above the left end of the scale. If the option is specified
as an empty string, no label is displayed.
Specifies the desired long dimension of the scale in screen units
(i.e. any of the forms acceptable to Tk_GetPixels).
For vertical scales this is the scale's height; for horizontal scales
it is the scale's width.
A real value specifying the resolution for the scale.
If this value is greater than zero then the scale's value will always be
rounded to an even multiple of this value, as will tick marks and
the endpoints of the scale. If the value is less than zero then no
rounding occurs. Defaults to 1 (i.e., the value will be integral).
Specifies one of three states for the scale: normal,
active, or disabled.
If the scale is disabled then the value may not be changed and the scale
If the scale is active, the slider is displayed using the color
specified by the activeBackground option.
Specifies the name of a global variable to link to the scale. Whenever the
value of the variable changes, the scale will update to reflect this
Whenever the scale is manipulated interactively, the variable
will be modified to reflect the scale's new value.
Specifies the desired narrow dimension of the trough in screen units
(i.e. any of the forms acceptable to Tk_GetPixels).
For vertical scales this is the trough's width; for horizontal scales
this is the trough's height.
The Scale method creates a new window (given by the
$widget argument) and makes it into a scale widget.
options, described above, may be specified on the command line
or in the option database
to configure aspects of the scale such as its colors, orientation,
and relief. The scale command returns its
$widget argument. At the time this command is invoked,
there must not exist a window named $widget, but
$widget's parent must exist.
A scale is a widget that displays a rectangular trough and a
small slider. The trough corresponds to a range
of real values (determined by the from, to, and
and the position of the slider selects a particular real value.
The slider's position (and hence the scale's value) may be adjusted
with the mouse or keyboard as described in
the BINDINGS section below. Whenever the scale's value is changed, a Tcl
command is invoked (using the command option) to notify
other interested widgets of the change.
In addition, the value
of the scale can be linked to a Tcl variable (using the variable
option), so that changes in either are reflected in the other.
Three annotations may be displayed in a scale widget: a label
appearing at the top right of the widget (top left for horizontal
scales), a number displayed just to the left of the slider
(just above the slider for horizontal scales), and a collection
of numerical tick marks just to the left of the current value
(just below the trough for horizontal scales). Each of these three
annotations may be enabled or disabled using the
The Scale method creates a widget object.
This object supports the configure and cget methods
described in the Tk::options manpage which can be used to enquire and
modify the options described above.
The widget also inherits all the methods provided by the generic
The following additional methods are available for scale widgets:
If x and y are omitted, returns the current value
of the scale. If x and y are specified, they give
pixel coordinates within the widget; the command returns
the scale value corresponding to the given pixel.
Only one of x or y is used: for horizontal scales
y is ignored, and for vertical scales x is ignored.
Returns a string indicating what part of the scale lies under
the coordinates given by x and y.
A return value of slider means that the point is over
the slider; trough1 means that the point is over the
portion of the slider above or to the left of the slider;
and trough2 means that the point is over the portion
of the slider below or to the right of the slider.
If the point isn't over one of these elements, an empty string
This command is invoked to change the current value of the scale,
and hence the position at which the slider is displayed. Value
gives the new value for the scale.
The command has no effect if the scale is disabled.
Tk automatically creates class bindings for scales that give them
the following default behavior.
Where the behavior is different for vertical and horizontal scales,
the horizontal behavior is described in parentheses.
If button 1 is pressed in the trough, the scale's value will
be incremented or decremented by the value of the resolution
option so that the slider moves in the direction of the cursor.
If the button is held down, the action auto-repeats.