This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author andrei.avk
Recipients andrei.avk, epaine, serhiy.storchaka, thawn
Date 2021-08-21.00:40:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1629506404.92.0.323025787333.issue39827@roundup.psfhosted.org>
In-reply-to
Content
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()
History
Date User Action Args
2021-08-21 00:40:04andrei.avksetrecipients: + andrei.avk, serhiy.storchaka, thawn, epaine
2021-08-21 00:40:04andrei.avksetmessageid: <1629506404.92.0.323025787333.issue39827@roundup.psfhosted.org>
2021-08-21 00:40:04andrei.avklinkissue39827 messages
2021-08-21 00:40:04andrei.avkcreate