Tkinter is a GUI toolkit used in python to make user-friendly GUIs.Tkinter is the most commonly used and the most basic GUI framework available in python. Tkinter uses an object-oriented approach to make GUIs.
Note: For more information, refer to Python GUI – tkinter
The Scale widget is used whenever we want to select a specific value from a range of values. It provides a sliding bar through which we can select the values by sliding from left to right or top to bottom depending upon the orientation of our sliding bar.
S = Scale(root, bg, fg, bd, command, orient, from_, to, ..)
- root – root window.
- bg – background colour
- fg – foreground colour
- bd – border
- orient – orientation(vertical or horizontal)
- from_ – starting value
- to – ending value
- troughcolor – set colour for trough.
- state – decides if the widget will be responsive or unresponsive.
- sliderlength – decides the length of the slider.
- label – to display label in the widget.
- highlightbackground – the colour of the focus when widget is not focused.
- cursor – The cursor on the widget ehich could be arrow, circle, dot etc.
- set(value) – set the value for scale.
- get() – get the value of scale.
Example 1: Creating a horizontal bar
Example 2: Creating a vertical slider
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.