I'm trying to make a vertical slider with the Scale
widget that has words as the intervals. For example, a slider that has
- "maximum"
- "median"
- and "minimum"
in text as the intervals. Is it possible?
I'm trying to make a vertical slider with the Scale
widget that has words as the intervals. For example, a slider that has
in text as the intervals. Is it possible?
Depending on what you want to do with your slider, you can use label
from tk.Scale
:
import tkinter as tk
SCALE_LABELS = {
0: "minimum",
1: "median",
2: "maximum"
}
def scale_labels(value):
scale.config(label=SCALE_LABELS[int(value)])
root = tk.Tk()
scale = tk.Scale(root, from_=min(SCALE_LABELS), to=max(SCALE_LABELS),
orient=tk.HORIZONTAL, showvalue=False, command=scale_labels)
scale.pack()
root.mainloop()