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

NAME

8       scale - Create and manipulate 'scale' value-controlled slider 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       Command-Line Name:-bigincrement
24       Database Name:  bigIncrement
25       Database Class: BigIncrement
26
27              Some  interactions  with  the scale cause its value to change by
28              “large” increments;  this option specifies the size of the large
29              increments.   If specified as 0, the large increments default to
30              1/10 the range of the scale.
31
32       Command-Line Name:-command
33       Database Name:  command
34       Database Class: Command
35
36              Specifies the prefix of a Tcl command  to  invoke  whenever  the
37              scale's  value is changed via a widget command.  The actual com‐
38              mand consists of this option followed by a space and a real num‐
39              ber indicating the new value of the scale.
40
41       Command-Line Name:-digits
42       Database Name:  digits
43       Database Class: Digits
44
45              An  integer  specifying  how  many  significant digits should be
46              retained when converting the value of the scale to a string.  If
47              the  number  is less than or equal to zero, then the scale picks
48              the smallest value that guarantees that  every  possible  slider
49              position prints as a different string.
50
51       Command-Line Name:-from
52       Database Name:  from
53       Database Class: From
54
55              A real value corresponding to the left or top end of the scale.
56
57       Command-Line Name:-label
58       Database Name:  label
59       Database Class: Label
60
61              A  string  to  display  as  a label for the scale.  For vertical
62              scales the label is displayed just to the right of the  top  end
63              of the scale.  For horizontal scales the label is displayed just
64              above the left end of the scale.  If the option is specified  as
65              an empty string, no label is displayed.
66
67       Command-Line Name:-length
68       Database Name:  length
69       Database Class: Length
70
71              Specifies  the  desired  long  dimension  of the scale in screen
72              units (i.e. any of the forms acceptable to  Tk_GetPixels).   For
73              vertical  scales  this  is  the  scale's height;  for horizontal
74              scales it is the scale's width.
75
76       Command-Line Name:-resolution
77       Database Name:  resolution
78       Database Class: Resolution
79
80              A real value specifying the resolution for the scale.   If  this
81              value is greater than zero then the scale's value will always be
82              rounded to an even multiple of this value, as  will  tick  marks
83              and  the endpoints of the scale.  If the value is less than zero
84              then no rounding occurs.  Defaults to 1 (i.e., the value will be
85              integral).
86
87       Command-Line Name:-showvalue
88       Database Name:  showValue
89       Database Class: ShowValue
90
91              Specifies  a boolean value indicating whether or not the current
92              value of the scale is to be displayed.
93
94       Command-Line Name:-sliderlength
95       Database Name:  sliderLength
96       Database Class: SliderLength
97
98              Specifies the size of the slider, measured in screen units along
99              the  slider's long dimension.  The value may be specified in any
100              of the forms acceptable to Tk_GetPixels.
101
102       Command-Line Name:-sliderrelief
103       Database Name:  sliderRelief
104       Database Class: SliderRelief
105
106              Specifies the relief to use when drawing  the  slider,  such  as
107              raised or sunken.
108
109       Command-Line Name:-state
110       Database Name:  state
111       Database Class: State
112
113              Specifies one of three states for the scale:  normal, active, or
114              disabled.  If the scale is disabled then the value  may  not  be
115              changed  and  the  scale  will  not  activate.   If the scale is
116              active, the slider is displayed using the color specified by the
117              -activebackground option.
118
119       Command-Line Name:-tickinterval
120       Database Name:  tickInterval
121       Database Class: TickInterval
122
123              Must  be a real value.  Determines the spacing between numerical
124              tick marks displayed below or to the left of the slider.  If  0,
125              no tick marks will be displayed.
126
127       Command-Line Name:-to
128       Database Name:  to
129       Database Class: To
130
131              Specifies  a real value corresponding to the right or bottom end
132              of the scale.  This value may be either  less  than  or  greater
133              than the -from option.
134
135       Command-Line Name:-variable
136       Database Name:  variable
137       Database Class: Variable
138
139              Specifies  the  name  of a global variable to link to the scale.
140              Whenever the value of  the  variable  changes,  the  scale  will
141              update to reflect this value.  Whenever the scale is manipulated
142              interactively, the variable will  be  modified  to  reflect  the
143              scale's new value.
144
145       Command-Line Name:-width
146       Database Name:  width
147       Database Class: Width
148
149              Specifies  the  desired  narrow dimension of the scale in screen
150              units (i.e. any of the forms acceptable to  Tk_GetPixels).   For
151              vertical  scales  this  is  the  scale's  width;  for horizontal
152              scales this is the scale's height.
153______________________________________________________________________________
154

DESCRIPTION

156       The scale command creates a new window (given by the pathName argument)
157       and makes it into a scale widget.  Additional options, described above,
158       may be specified on the command line or in the option database to  con‐
159       figure  aspects  of  the  scale  such  as  its colors, orientation, and
160       relief.  The scale command returns its pathName argument.  At the  time
161       this  command is invoked, there must not exist a window named pathName,
162       but pathName's parent must exist.
163
164       A scale is a widget that displays a  rectangular  trough  and  a  small
165       slider.   The  trough corresponds to a range of real values (determined
166       by the -from, -to, and -resolution options), and the  position  of  the
167       slider  selects  a  particular  real value.  The slider's position (and
168       hence the scale's value) may be adjusted with the mouse or keyboard  as
169       described in the BINDINGS section below.  Whenever the scale's value is
170       changed, a Tcl command is invoked (using the -command option) to notify
171       other  interested widgets of the change.  In addition, the value of the
172       scale can be linked to a Tcl variable (using the -variable option),  so
173       that changes in either are reflected in the other.
174
175       Three  annotations may be displayed in a scale widget:  a label appear‐
176       ing at the top right of the widget (top left for horizontal scales),  a
177       number  displayed just to the left of the slider (just above the slider
178       for horizontal scales), and a collection of numerical tick  marks  just
179       to  the left of the current value (just below the trough for horizontal
180       scales).  Each of these three annotations may be  enabled  or  disabled
181       using the configuration options.
182

WIDGET COMMAND

184       The  scale  command  creates  a new Tcl command whose name is pathName.
185       This command may be used to invoke various operations  on  the  widget.
186       It has the following general form:
187              pathName option ?arg arg ...?
188       Option  and  the args determine the exact behavior of the command.  The
189       following commands are possible for scale widgets:
190
191       pathName cget option
192              Returns the current value of the configuration option  given  by
193              option.  Option may have any of the values accepted by the scale
194              command.
195
196       pathName configure ?option? ?value option value ...?
197              Query or modify the configuration options of the widget.  If  no
198              option is specified, returns a list describing all of the avail‐
199              able options for pathName (see Tk_ConfigureInfo for  information
200              on  the  format  of  this list).  If option is specified with no
201              value, then the command returns a list describing the one  named
202              option (this list will be identical to the corresponding sublist
203              of the value returned if no option is  specified).   If  one  or
204              more option-value pairs are specified, then the command modifies
205              the given widget option(s) to have the given value(s);  in  this
206              case  the  command returns an empty string.  Option may have any
207              of the values accepted by the scale command.
208
209       pathName coords ?value?
210              Returns a list whose elements are the x and y coordinates of the
211              point  along  the  centerline  of the trough that corresponds to
212              value.  If value is omitted then the scale's  current  value  is
213              used.
214
215       pathName get ?x y?
216              If  x and y are omitted, returns the current value of the scale.
217              If x and y are specified, they give pixel coordinates within the
218              widget;   the  command  returns the scale value corresponding to
219              the given pixel.  Only one of x or y is  used:   for  horizontal
220              scales y is ignored, and for vertical scales x is ignored.
221
222       pathName identify x y
223              Returns  a  string  indicating what part of the scale lies under
224              the coordinates given by x and y.   A  return  value  of  slider
225              means that the point is over the slider;  trough1 means that the
226              point is over the portion of the slider above  or to the left of
227              the slider; and trough2 means that the point is over the portion
228              of the slider below or to the right of the slider.  If the point
229              is not over one of these elements, an empty string is returned.
230
231       pathName set value
232              This  command  is  invoked  to  change  the current value of the
233              scale, and hence the position at which the slider is  displayed.
234              Value  gives  the  new  value for the scale.  The command has no
235              effect if the scale is disabled.
236

BINDINGS

238       Tk automatically creates class bindings for scales that give  them  the
239       following default behavior.  Where the behavior is different for verti‐
240       cal and horizontal scales, the  horizontal  behavior  is  described  in
241       parentheses.
242
243       [1]    If  button 1 is pressed in the trough, the scale's value will be
244              incremented or decremented  by  the  value  of  the  -resolution
245              option  so that the slider moves in the direction of the cursor.
246              If the button is held down, the action auto-repeats.
247
248       [2]    If button 1 is pressed  over  the  slider,  the  slider  can  be
249              dragged with the mouse.
250
251       [3]    If  button 1 is pressed in the trough with the Control key down,
252              the slider moves all the way to the end of  its  range,  in  the
253              direction towards the mouse cursor.
254
255       [4]    If  button  2  is pressed, the scale's value is set to the mouse
256              position.  If the mouse is  dragged  with  button  2  down,  the
257              scale's value changes with the drag.
258
259       [5]    The  Up  and Left keys move the slider up (left) by the value of
260              the -resolution option.
261
262       [6]    The Down and Right keys move the  slider  down  (right)  by  the
263              value of the -resolution option.
264
265       [7]    Control-Up  and  Control-Left  move  the slider up (left) by the
266              value of the -bigincrement option.
267
268       [8]    Control-Down and Control-Right move the slider down  (right)  by
269              the value of the -bigincrement option.
270
271       [9]    Home moves the slider to the top (left) end of its range.
272
273       [10]   End moves the slider to the bottom (right) end of its range.
274
275       If the scale is disabled using the -state option then none of the above
276       bindings have any effect.
277
278       The behavior of scales can be changed  by  defining  new  bindings  for
279       individual widgets or by redefining the class bindings.
280

SEE ALSO

282       ttk::scale(n)
283

KEYWORDS

285       scale, slider, trough, widget
286
287
288
289Tk                                    4.1                             scale(n)
Impressum