I think that setting the option resolution
instead of tickinterval
(which you have set) to 0.01 or even 0.001 will cause it to at least to retrieve the value of scrollbar in that precision, e.g. 2.15 or 2.150. That could also allow you to set float values to from
and to
options, but I can't test it now, so it's highly possible that I'm wrong.
How to use non-integer, float values for tkinter Scale widget scrollbar?
-
29-06-2022 - |
题
I need to set the scale from 0.55 to 2.75 with a very little interval for my slide
But all I get is a range from 1 to 3 with a scale of 1. Totally annoying. TkInter documentation says it can handle floating values, so what's wrong?
Scale(window,label='Set Value', from_=0.55, to=2.75, tickinterval=0.001).pack()
解决方案
其他提示
Assuming your interval is 0.01, you can try this.
Scale(frame, from_=0.55, to=2.75, digits = 3, resolution = 0.01, label = "Lower").pack()
You will get (digits-1) number of decimals. (In this case 2). So, 0.55,0.56, 0.57 ....., 2.75
不隶属于 StackOverflow