Is it possible to set Tkinter tickinterval as a magnitude?

206 Views Asked by At

I want to use a Tkinter scale to set the magnitude of an input. Therefore I want the ticks of the scale to be 1, 10, 100, 1000 etc.

My initial thoughts are that I will have the scale

magnitudescale = Scale(window1, from_ = 0, to = 3)

When the scale is moved there would be some function that takes the scale position and alters the value by 10^x

Is there a clean way to do this?

1

There are 1 best solutions below

0
On

magnitudescale = Scale(window1, from_ = 0, to = 3)

I found that there are some clever ways to do this but none that do exactly what the question asks. The way that I ended up implementing this is to have the scale position command a function that takes the position of the scale and calculates 10^(X) this code looks like this

10**(magnitudescale.get())

Using this calculation we can change the text in a label placed above the scale so that the slider position corresponds with the values "1, 10, 100, 1000, etc."