ttk::scale(3tk)

πŸ“¦
version 9.0.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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: Command Specifies 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: From a real value that corresponds to the left or top end of the scale πŸ’«
  • -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 to Tk_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: Orient specifies which orientation the widget should be laid out in β€” horizontal or vertical. must be either horizontal or vertical, or an abbreviation of one of these 🌈
  • -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 -from option πŸ‘€
  • -value β€” Command-Line Name: -value, Database Name: value, Database Class: Value specifies the current floating-point value of the variable. if -variable is set to an existing variable, specifying -value has no effect β€” the variable value takes precedence πŸ’€
  • -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 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 -value option, 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 -value option) to value. the value gets clipped to the range given by the -from and -to options. note that setting the linked variable (i.e. the variable named in the -variable option) 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 -value option 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 πŸ¦‹


⭐ 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