Message400005
I wrote a longer explanation but BPO and Chrome ate it.
The issue is that DoubleVar is not locale aware. I don't know what should be the actual fix but the following may be a useful workaround (It works on my system):
import tkinter
import locale
import sys
locale.setlocale(locale.LC_NUMERIC, 'de_DE')
class Var(tkinter.DoubleVar):
def get(self):
return locale.atof(self._tk.globalgetvar(self._name))
class TestDoubleVar():
def __init__(self):
root = tkinter.Tk()
self.var = Var()
self.var.set(0.8)
number = tkinter.Spinbox(
root,
from_=0, to=1, increment=0.1,
textvariable=self.var,
command=self.update,
width=4
)
number.pack(side=tkinter.LEFT)
root.mainloop()
def update(self, *args):
print(self.var.get())
if __name__ == '__main__':
TestDoubleVar() |
|
Date |
User |
Action |
Args |
2021-08-21 00:40:04 | andrei.avk | set | recipients:
+ andrei.avk, serhiy.storchaka, thawn, epaine |
2021-08-21 00:40:04 | andrei.avk | set | messageid: <1629506404.92.0.323025787333.issue39827@roundup.psfhosted.org> |
2021-08-21 00:40:04 | andrei.avk | link | issue39827 messages |
2021-08-21 00:40:04 | andrei.avk | create | |
|