scale(3tk)
β¨ scale(3tk) β¨
okay bestie, welcome to the scale widget manual page β part 1 of 2, and it's giving slider realness, no cap. π
πΈ NAME πΈ
scale β create and manipulate scale value-controlled slider widgets ποΈβ¨
π SYNOPSIS π
scale pathName ?options?
π STANDARD OPTIONS π
-activebackground-background-borderwidth-cursor-font-foreground-highlightbackground-highlightcolor-highlightthickness-orient-relief-repeatdelay-repeatinterval-takefocus-troughcolor
See the options manual entry for details on the standard options. iykyk. π«Ά
π¦ WIDGET-SPECIFIC OPTIONS π¦
-bigincrementβ Command-Line Name:-bigincrement; Database Name:bigIncrement; Database Class:BigIncrement. Some interactions with the scale cause its value to change by βlargeβ increments; this option specifies the size of the large increments. If specified as0, the large increments default to1/10the range of the scale. π₯-commandβ Command-Line Name:-command; Database Name:command; Database Class:Command. Specifies the prefix of a Tcl command to invoke whenever the scale's value is changed via a widget command. The actual command consists of this option followed by a space and a real number indicating the new value of the scale. β¨-digitsβ Command-Line Name:-digits; Database Name:digits; Database Class:Digits. An integer specifying how many significant digits should be retained when converting the value of the scale to a string. If the number is negative or zero, then the scale picks the smallest value that guarantees that every possible slider position prints as a different string. π-fromβ Command-Line Name:-from; Database Name:from; Database Class:From. A real value corresponding to the left or top end of the scale. ποΈ-labelβ Command-Line Name:-label; Database Name:label; Database Class:Label. 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. π·οΈ-lengthβ Command-Line Name:-length; Database Name:length; Database Class:Length. Specifies the desired long dimension of the scale in screen units (i.e. any of the forms acceptable toTk_GetPixels). For vertical scales this is the scale's height; for horizontal scales it is the scale's width. π-resolutionβ Command-Line Name:-resolution; Database Name:resolution; Database Class:Resolution. 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 the endpoints of the scale. If the value is negative then no rounding occurs. Defaults to1(i.e., the value will be integral). π’-showvalueβ Command-Line Name:-showvalue; Database Name:showValue; Database Class:ShowValue. Specifies a boolean value indicating whether or not the current value of the scale is to be displayed. π-sliderlengthβ Command-Line Name:-sliderlength; Database Name:sliderLength; Database Class:SliderLength. Specifies the size of the slider, measured in screen units along the slider's long dimension. The value may be specified in any of the forms acceptable toTk_GetPixels. ποΈ-sliderreliefβ Command-Line Name:-sliderrelief; Database Name:sliderRelief; Database Class:SliderRelief. Specifies the relief to use when drawing the slider, such asraisedorsunken. πͺ-stateβ Command-Line Name:-state; Database Name:state; Database Class:State. Specifies one of three states for the scale:normal,active, ordisabled. If the scale is disabled then the value may not be changed and the scale will not activate. If the scale is active, the slider is displayed using the color specified by the-activebackgroundoption. π¦-tickintervalβ Command-Line Name:-tickinterval; Database Name:tickInterval; Database Class:TickInterval. Must be a real value. Determines the spacing between numerical tick marks displayed below or to the left of the slider. The values will all be displayed with the same number of decimal places, which will be enough to ensure they are all accurate to within 20% of a tick interval. If0, no tick marks will be displayed. π-toβ Command-Line Name:-to; Database Name:to; Database Class:To. Specifies a real value corresponding to the right or bottom end of the scale. This value may be either less than or greater than the-fromoption. π-variableβ Command-Line Name:-variable; Database Name:variable; Database Class:Variable. 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 value. Whenever the scale is manipulated interactively, the variable will be modified to reflect the scale's new value. π-widthβ Command-Line Name:-width; Database Name:width; Database Class:Width. Specifies the desired narrow dimension of the scale in screen units (i.e. any of the forms acceptable toTk_GetPixels). For vertical scales this is the scale's width; for horizontal scales this is the scale's height. βοΈ
π DESCRIPTION π
okay so 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 ...?
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 thescalecommand. π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 (seeTk_ConfigureInfofor 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 thescalecommand. βοΈ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 ofslidermeans that the point is over the slider;trough1means that the point is over the portion of the slider above or to the left of the slider; andtrough2means that the point is over the portion of the slider below or to the right of the slider. If the point is not 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 β¨
okay so bestie, Tk is out here automatically creating class bindings for scales, and they give them these default behaviors. no cap. when the behavior is different for vertical vs horizontal scales, the horizontal tea is in the parentheses. iykyk. π
[1]β ifbutton 1gets pressed in the trough, the scale's value will be incremented or decremented by the value of the-resolutionoption so that the slider moves in the direction of the cursor. if the button is held down, the action auto-repeats. periodt. π₯[2]β ifbutton 1is pressed over the slider, the slider can be dragged with the mouse. drag her, she's ready. π«Ά[3]β ifbutton 1is pressed in the trough with the Control key down, the slider moves all the way to the end of its range, in the direction towards the mouse cursor. she's going the distance. β¨[4]β ifbutton 2is pressed, the scale's value is set to the mouse position. if the mouse is dragged withbutton 2down, the scale's value changes with the drag. it's giving direct control, fr fr. π¦[5]β the Up and Left keys move the slider up (left) by the value of the-resolutionoption. tiny steps, cute steps. π[6]β the Down and Right keys move the slider down (right) by the value of the-resolutionoption. same energy, opposite direction. π[7]β Control-Up and Control-Left move the slider up (left) by the value of the-bigincrementoption. big moves only. π[8]β Control-Down and Control-Right move the slider down (right) by the value of the-bigincrementoption. big moves, but downward/rightward. iconic. π[9]β Home moves the slider to the top (left) end of its range. go home, slider. π[10]β End moves the slider to the bottom (right) end of its range. the end, bestie. π
if the scale is disabled using the -state option, then none of the above bindings have any effect. she's on do not disturb. π«
the behavior of scales can be changed by defining new bindings for individual widgets or by redefining the class bindings. customize your girl, slay. π
π SEE ALSO π
ttk::scale(3tk)
π KEYWORDS π
scaleslidertroughwidget
sending love from the Tk 4.1 era, page scale(3tk) β date wasn't printed on the footer, but the vibe is eternal. mwah, bestie π
πβ¨
π¦ where this page comes from
- debian trixie: tk9.0-doc 9.0.1-3
- ubuntu questing: tk9.0-doc 9.0.2-1
- ubuntu resolute: tk9.0-doc 9.0.3-1
- ubuntu stonking: tk9.0-doc 9.0.4-1
- Copyright (c) 1990-1994 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms