I'm new with tkinter, and I want to create a slider like the one in this picture:

But I have no idea if this is even possible, so my question is: Is this possible, and does someone has a quick tutorial or something for me?
Copyright © 2021 Jogjafile Inc.
This can be done by customizing a ttk theme. The idea is to use images for the scale's trough (a small gray square) and slider (a circle). Theme elements can be created from these images using:
Then the layout of the scale has to be created with
so that it uses the created elements. I have added a label to display the value but it will be accessible only through the style so we have to use a unique style name for each created scale, e.g.
'<scale name>.custom.Vertical.TScale'. Then we can change the text withTo keep the label's text up to date with the scale's value, we can use a trace on the scale's variable, as done in the
CustomScaleclass below.Here is the full code:
The main drawback is that the slide does not react if you click on the label.
Note: to have the same for a horizontal scale, create the layout:
and just use the
orient="horizontal"when creating theCustomScale, like for a regularScale.