1scale(n)                     Tk Built-In Commands                     scale(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       scale - Create and manipulate scale widgets
9

SYNOPSIS

11       scale pathName ?options?
12

STANDARD OPTIONS

14       -activebackground     -foreground          -relief
15       -background           -highlightbackground -repeatdelay
16       -borderwidth          -highlightcolor      -repeatinterval
17       -cursor               -highlightthickness  -takefocus
18       -font                 -orient              -troughcolor
19
20       See the options manual entry for details on the standard options.
21

WIDGET-SPECIFIC OPTIONS

23       [-bigincrement bigIncrement] Some interactions with the scale cause its
24       value to change by “large” increments;  this option specifies the  size
25       of  the  large  increments.   If  specified  as 0, the large increments
26       default to 1/10 the range of the scale.   [-command command]  Specifies
27       the  prefix  of  a  Tcl command to invoke whenever the scale's value is
28       changed via a widget command.  The  actual  command  consists  of  this
29       option  followed  by a space and a real number indicating the new value
30       of the scale.  [-digits digits] An integer specifying how many signifi‐
31       cant  digits  should be retained when converting the value of the scale
32       to a string.  If the number is less than or equal  to  zero,  then  the
33       scale  picks  the  smallest  value  that guarantees that every possible
34       slider position prints as a  different  string.   [-from from]  A  real
35       value   corresponding   to   the   left   or  top  end  of  the  scale.
36       [-label label] A string to display as a label for the scale.  For  ver‐
37       tical scales the label is displayed just to the right of the top end of
38       the scale.  For horizontal scales the label is displayed just above the
39       left  end of the scale.  If the option is specified as an empty string,
40       no label is displayed.  [-length length]  Specifies  the  desired  long
41       dimension  of  the scale in screen units (i.e. any of the forms accept‐
42       able to Tk_GetPixels).  For vertical scales this is the scale's height;
43       for  horizontal  scales  it is the scale's width.  [-resolution resolu‐
44       tion] A real value specifying the resolution for the  scale.   If  this
45       value  is  greater  than  zero  then  the  scale's value will always be
46       rounded to an even multiple of this value, as will tick marks  and  the
47       endpoints  of the scale.  If the value is less than zero then no round‐
48       ing occurs.  Defaults to 1 (i.e., the value will be integral).  [-show‐
49       value showValue]  Specifies  a  boolean value indicating whether or not
50       the  current  value  of  the  scale  is  to  be  displayed.   [-slider‐
51       length sliderLength]  Specifies  the  size  of  the slider, measured in
52       screen units along the slider's long dimension.  The value may be spec‐
53       ified  in  any  of  the  forms acceptable to Tk_GetPixels.  [-sliderre‐
54       lief sliderRelief] Specifies the relief to use when drawing the slider,
55       such as raised or sunken.  [-state state] Specifies one of three states
56       for the scale:  normal, active, or disabled.  If the scale is  disabled
57       then  the value may not be changed and the scale will not activate.  If
58       the scale is active, the slider is displayed using the color  specified
59       by the activeBackground option.  [-tickinterval tickInterval] Must be a
60       real value.  Determines the spacing between numerical tick  marks  dis‐
61       played below or to the left of the slider.  If 0, no tick marks will be
62       displayed.  [-to to] Specifies a real value corresponding to the  right
63       or  bottom  end  of  the  scale.  This value may be either less than or
64       greater than the from option.  [-variable variable] Specifies the  name
65       of  a  global variable to link to the scale.  Whenever the value of the
66       variable changes, the scale will update to reflect this  value.   When‐
67       ever the scale is manipulated interactively, the variable will be modi‐
68       fied to reflect the scale's new value.   [-width width]  Specifies  the
69       desired narrow dimension of the trough in screen units (i.e. any of the
70       forms acceptable to Tk_GetPixels).  For vertical  scales  this  is  the
71       trough's width;  for horizontal scales this is the trough's height.
72_________________________________________________________________
73
74

DESCRIPTION

76       The scale command creates a new window (given by the pathName argument)
77       and makes it into a scale widget.  Additional options, described above,
78       may  be specified on the command line or in the option database to con‐
79       figure aspects of the  scale  such  as  its  colors,  orientation,  and
80       relief.   The scale command returns its pathName argument.  At the time
81       this command is invoked, there must not exist a window named  pathName,
82       but pathName's parent must exist.
83
84       A  scale  is  a  widget  that displays a rectangular trough and a small
85       slider.  The trough corresponds to a range of real  values  (determined
86       by  the  from,  to,  and  resolution  options), and the position of the
87       slider selects a particular real value.   The  slider's  position  (and
88       hence  the scale's value) may be adjusted with the mouse or keyboard as
89       described in the BINDINGS section below.  Whenever the scale's value is
90       changed,  a Tcl command is invoked (using the command option) to notify
91       other interested widgets of the change.  In addition, the value of  the
92       scale  can  be linked to a Tcl variable (using the variable option), so
93       that changes in either are reflected in the other.
94
95       Three annotations may be displayed in a scale widget:  a label  appear‐
96       ing  at the top right of the widget (top left for horizontal scales), a
97       number displayed just to the left of the slider (just above the  slider
98       for  horizontal  scales), and a collection of numerical tick marks just
99       to the left of the current value (just below the trough for  horizontal
100       scales).   Each  of  these three annotations may be enabled or disabled
101       using the configuration options.
102

WIDGET COMMAND

104       The scale command creates a new Tcl command  whose  name  is  pathName.
105       This  command  may  be used to invoke various operations on the widget.
106       It has the following general form:
107              pathName option ?arg arg ...?
108       Option and the args determine the exact behavior of the  command.   The
109       following commands are possible for scale widgets:
110
111       pathName cget option
112              Returns  the  current value of the configuration option given by
113              option.  Option may have any of the values accepted by the scale
114              command.
115
116       pathName configure ?option? ?value option value ...?
117              Query  or modify the configuration options of the widget.  If no
118              option is specified, returns a list describing all of the avail‐
119              able  options for pathName (see Tk_ConfigureInfo for information
120              on the format of this list).  If option  is  specified  with  no
121              value,  then the command returns a list describing the one named
122              option (this list will be identical to the corresponding sublist
123              of  the  value  returned  if no option is specified).  If one or
124              more option-value pairs are specified, then the command modifies
125              the  given widget option(s) to have the given value(s);  in this
126              case the command returns an empty string.  Option may  have  any
127              of the values accepted by the scale command.
128
129       pathName coords ?value?
130              Returns a list whose elements are the x and y coordinates of the
131              point along the centerline of the  trough  that  corresponds  to
132              value.   If  value  is omitted then the scale's current value is
133              used.
134
135       pathName get ?x y?
136              If x and y are omitted, returns the current value of the  scale.
137              If x and y are specified, they give pixel coordinates within the
138              widget;  the command returns the scale  value  corresponding  to
139              the  given  pixel.   Only one of x or y is used:  for horizontal
140              scales y is ignored, and for vertical scales x is ignored.
141
142       pathName identify x y
143              Returns a string indicating what part of the  scale  lies  under
144              the  coordinates  given  by  x  and y.  A return value of slider
145              means that the point is over the slider;  trough1 means that the
146              point is over the portion of the slider above  or to the left of
147              the slider; and trough2 means that the point is over the portion
148              of the slider below or to the right of the slider.  If the point
149              is not over one of these elements, an empty string is returned.
150
151       pathName set value
152              This command is invoked to  change  the  current  value  of  the
153              scale,  and hence the position at which the slider is displayed.
154              Value gives the new value for the scale.   The  command  has  no
155              effect if the scale is disabled.
156

BINDINGS

158       Tk  automatically  creates class bindings for scales that give them the
159       following default behavior.  Where the behavior is different for verti‐
160       cal  and  horizontal  scales,  the  horizontal behavior is described in
161       parentheses.
162
163       [1]    If button 1 is pressed in the trough, the scale's value will  be
164              incremented or decremented by the value of the resolution option
165              so that the slider moves in the direction of the cursor.  If the
166              button is held down, the action auto-repeats.
167
168       [2]    If  button  1  is  pressed  over  the  slider, the slider can be
169              dragged with the mouse.
170
171       [3]    If button 1 is pressed in the trough with the Control key  down,
172              the  slider  moves  all  the way to the end of its range, in the
173              direction towards the mouse cursor.
174
175       [4]    If button 2 is pressed, the scale's value is set  to  the  mouse
176              position.   If  the  mouse  is  dragged  with button 2 down, the
177              scale's value changes with the drag.
178
179       [5]    The Up and Left keys move the slider up (left) by the  value  of
180              the resolution option.
181
182       [6]    The  Down  and  Right  keys  move the slider down (right) by the
183              value of the resolution option.
184
185       [7]    Control-Up and Control-Left move the slider  up  (left)  by  the
186              value of the bigIncrement option.
187
188       [8]    Control-Down  and  Control-Right move the slider down (right) by
189              the value of the bigIncrement option.
190
191       [9]    Home moves the slider to the top (left) end of its range.
192
193       [10]   End moves the slider to the bottom (right) end of its range.
194
195       If the scale is disabled using the state option then none of the  above
196       bindings have any effect.
197
198       The  behavior  of  scales  can  be changed by defining new bindings for
199       individual widgets or by redefining the class bindings.
200
201

KEYWORDS

203       scale, slider, trough, widget
204
205
206
207Tk                                    4.1                             scale(n)
Impressum