Search code examples
tclscaletk-toolkit

How to increase a Tcl Tk scale by 0.1


How can I increase scale widget in Tcl/Tk to increase by a floating point number e.g 0.1?. Below is my code:

#!/usr/bin/wish

package require Tk

scale .meter -from 0 -to 10  -variable r -label meter -orient horizontal
pack .meter  -fill both -expand true

Solution

  • You can use the -resolution option:

    #!/usr/bin/wish
    
    package require Tk
    
    scale .meter -from 0 -to 10  -variable r -label meter -orient horizontal -resolution 0.1
    pack .meter  -fill both -expand true
    

    Will take all increment/decrement by 0.1.