[issue31613] Localize tkinter.simpledialog.Default buttons as with file dialogs.

Sampo Hippeläinen report at bugs.python.org
Fri Mar 4 09:30:18 EST 2022


Sampo Hippeläinen <sampo.hippelainen at gmail.com> added the comment:

>Tk does not provide localized [Ok] and [Cancel] buttons.

This is not true. You can call ::msgcat::mc to localize core strings such as "OK" and "Cancel".

The full tk.call becomes

    tk.call("namespace", "eval", "::tk", "::msgcat::mc", s)

to translate a string s, such as "OK".

I have made a custom modified version of simpledialog.py that makes use of this and indeed localizes the OK/Cancel buttons as they would be localized for tk messageboxes (which use Tcl/Tk Core localization). I submitted this now as a GitHub PR.

----------
nosy: +sampo.hippelainen

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31613>
_______________________________________


More information about the Python-bugs-list mailing list