scale - Create and manipulate scale widgets

SYNOPSIS

scale pathName ?options?

STANDARD OPTIONS

activeBackground	font	highlightThickness	repeatInterval
background	foreground	orient	takeFocus
borderWidth	highlightBackground	relief	troughColor
cursor	highlightColor	repeatDelay

See the options manual entry for details on the standard options.

WIDGET-SPECIFIC OPTIONS

Name:	bigIncrement
Class:	BigIncrement
Command-Line Switch:	-bigincrement

Name:	command
Class:	Command
Command-Line Switch:	-command

Name:	digits
Class:	Digits
Command-Line Switch:	-digits

Name:	from
Class:	From
Command-Line Switch:	-from

Name:	label
Class:	Label
Command-Line Switch:	-label

Name:	length
Class:	Length
Command-Line Switch:	-length

Name:	resolution
Class:	Resolution
Command-Line Switch:	-resolution

Name:	showValue
Class:	ShowValue
Command-Line Switch:	-showvalue

Name:	sliderLength
Class:	SliderLength
Command-Line Switch:	-sliderlength

Name:	state
Class:	State
Command-Line Switch:	-state

Name:	tickInterval
Class:	TickInterval
Command-Line Switch:	-tickinterval

Name:	to
Class:	To
Command-Line Switch:	-to

Name:	variable
Class:	Variable
Command-Line Switch:	-variable

Name:	width
Class:	Width
Command-Line Switch:	-width

DESCRIPTION

The scale command creates a new window (given by the pathName argument) and makes it into a scale widget. Additional 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 pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName'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 resolution options), 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 configuration options.

WIDGET COMMAND

The scale command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form:

pathName option ?arg arg ...?
Option and the args determine the exact behavior of the command. The following commands are possible for scale widgets:
pathName cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the scale command.
pathName configure ?option? ?value option value ...?
Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the scale command.
pathName coords ?value?
Returns a list whose elements are the x and y coordinates of the point along the centerline of the trough that corresponds to value. If value is omitted then the scale's current value is used.
pathName get ?x y?
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.
pathName identify x y
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 is returned.
pathName set value
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.

BINDINGS

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 the scale is disabled using the state option then none of the above bindings have any effect.

The behavior of scales can be changed by defining new bindings for individual widgets or by redefining the class bindings.

KEYWORDS

scale, slider, trough, widget