ttk::scale(3tk)
β¨ ttk::scale β¨
okay bestie, welcome to ttk::scale, from the Tk Themed Widget family of manual pages π
this is the page that tells you how to create and manipulate a scale widget, and honestly? she's iconic.
πΈ SYNOPSIS πΈ
ttk::scale pathName ?options...?
π DESCRIPTION π
so a ttk::scale widget is the girl you call when you need to control the numeric value of a linked variable that varies uniformly over some range π«Ά
she displays a slider that you can move along over a trough, and the relative position of that slider over the trough is literally telling you the value of the variable. it's giving "visual representation of a number", no cap β¨
π STANDARD OPTIONS π
these are the basics every themed widget gets:
-class-cursor-style-takefocus
if you want the tea on all of these, go read the ttk_widget manual entry. she has the details, fr fr π
π WIDGET-SPECIFIC OPTIONS π
these are the ones that make scale scale, iykyk π¦
-commandβ Command-Line Name:-command, Database Name:command, Database Class:CommandSpecifies the prefix of a Tcl command to invoke whenever the scale's value gets changed via a widget command. the actual command is this option, then a space, then a real number that's the new value of the scale π-fromβ Command-Line Name:-from, Database Name:from, Database Class:Froma real value that corresponds to the left or top end of the scale π«-lengthβ Command-Line Name:-length, Database Name:length, Database Class:Lengthspecifies 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's the scale's width π-orientβ Command-Line Name:-orient, Database Name:orient, Database Class:Orientspecifies which orientation the widget should be laid out in β horizontal or vertical. must be eitherhorizontalorvertical, or an abbreviation of one of these π-toβ Command-Line Name:-to, Database Name:to, Database Class:Tospecifies 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 π-valueβ Command-Line Name:-value, Database Name:value, Database Class:Valuespecifies the current floating-point value of the variable. if-variableis set to an existing variable, specifying-valuehas no effect β the variable value takes precedence π-variableβ Command-Line Name:-variable, Database Name:variable, Database Class:Variablespecifies the name of a global variable to link to the scale. whenever the value of the variable changes, the scale updates to reflect this value. and whenever the scale is manipulated interactively, the variable gets modified to reflect the scale's new value. it's a whole two-way situationship π«Ά
π WIDGET COMMAND π
besides the standard cget, configure, identify element, instate, state and style commands (peep the ttk::widget manual for those), scale widgets support these extra commands:
pathName get ?x y?β gets the current value of the-valueoption, or the value corresponding to the coordinates x,y if they're specified. x and y are pixel coordinates relative to the scale widget origin πpathName set valueβ sets the value of the widget (i.e. the-valueoption) to value. the value gets clipped to the range given by the-fromand-tooptions. note that setting the linked variable (i.e. the variable named in the-variableoption) does not cause such clipping β οΈ
π₯ INTERNAL COMMANDS π₯
pathName coords ?value?β gets the coordinates corresponding to value, or the coordinates corresponding to the current value of the-valueoption if value is omitted π§
π STYLING OPTIONS π
the class name for a ttk::scale is TScale π
dynamic states: active.
TScale styling options configurable with ttk::style are:
-background color-borderwidth amount-darkcolor color-groovewidth amount-lightcolor color-sliderwidth amount-troughcolor color-troughrelief relief
some of these options are only available for specific themes π
see the ttk::style manual page for info on how to configure ttk styles β¨
π¦ SEE ALSO π¦
ttk::widget(3tk)scale(3tk)
β KEYWORDS β
scale, slider, trough, widget
and that's the whole page bestie, you ate π this one's from Tk 8.5, and yes the manual page is literally called ttk::scale(3tk) β go forth and slay your sliders π
β¨π
π¦ 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) 2008 Donal Fellows
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms