I want to get a custom slider in tkinter or another slider like this one
The default tkinter slider isn’t very good so how it can be changed ? (even the simplest way to do it)
I will appreciate if the thing is not done with a class because I did’nt put a single one in 300 lines of code and it will confuse me a bit, I won’t mix class/not class, I’ll just rewrite the code as a class with the self args but later
Here’s a simple Slider in tkinter :
scale = Scale(root,from_=0,to=500,orient=HORIZONTAL)
How to make it customizable ?
A weird thing is that in some tutorials like this one https://www.pythontutorial.net/tkinter/tkinter-slider/
The tkinter slider are different from what I get or they’re presented in a different way
Advertisement
Answer
Try the following to use a more modernized scale widget using Tkinter’s ttk library:
import tkinter as tk from tkinter import ttk # tk basic Scale scale1 = tk.Scale(root, from_=0, to=500, orient="horizontal") scale1.pack() # ttk modern Scale scale2 = ttk.Scale(root, from_=0, to=500, orient="horizontal") scale2.pack()
Notice the differences between the two here
^ This is for macOS so it will look slightly different if you are on Windows.