Is there a way to get a float value (like 1.91, 1.92 and so on) using the tkinter Spinbox Widget in Python 3.x?
Thanks in advance
Use the format
and the increment
options. Format takes a string format value; use something like %.2f
for a floating point number truncated to two decimal places.
The increment option specifies the increment value; the default is 1.0.
Now, using get()
on a Spinbox returns an instance of str
. Typecast it to float to get a floating-point value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With