0

On the slider, the values will vary from 0.05 to 100 (1 as the center) and as the user changes slider's position, it will update the output logarithmically as shown in the image:

Image

How can I modify the intervals (labels under the slider) and the output in such a way?

DYZ
  • 55,249
  • 10
  • 64
  • 93
  • Does this answer your question? [How to use tkinter slider \`Scale\` widget with discrete steps?](https://stackoverflow.com/questions/25745011/how-to-use-tkinter-slider-scale-widget-with-discrete-steps) – stovfl Apr 23 '20 at 08:33

1 Answers1

1

You can math it by setting a command for your Scale widget::

import tkinter as tk

root = tk.Tk()

label = tk.Label(root, text="1.00")
label.pack()
scale = tk.Scale(root, from_=-20, to=20, tickinterval=0.1, orient="horizontal", showvalue=0)
scale.config(command=lambda e: label.config(text=f"{10**(scale.get()/10):.2f}"))
scale.pack()

root.mainloop()
Henry Yik
  • 22,275
  • 4
  • 18
  • 40