https://github.com/python/cpython/commit/59ff73aa77be7802ee5a0345692088f526162588
commit: 59ff73aa77be7802ee5a0345692088f526162588
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-06-24T06:37:55Z
summary:

[3.14] gh-84008: Document that the LC_NUMERIC locale affects tkinter numeric 
widgets (GH-152008) (GH-152050)

Spinbox, Scale and ttk.Spinbox format floating-point values according to
the LC_NUMERIC locale, but such values are always parsed with a period, so
a comma-decimal locale breaks DoubleVar.get().
(cherry picked from commit ee78d4323c174d0281fef5e04e965cda4c46eeb7)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>

files:
M Doc/library/tkinter.rst
M Doc/library/tkinter.ttk.rst

diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst
index 45e66a65c70d915..2155829f311c0ea 100644
--- a/Doc/library/tkinter.rst
+++ b/Doc/library/tkinter.rst
@@ -4849,6 +4849,9 @@ Widget classes
    dropped; *from* is spelled ``from_`` because :keyword:`from` is a Python
    keyword.
 
+   With a non-integer *resolution*, see :ref:`numeric values and the locale
+   <tkinter-numeric-locale>`.
+
    .. method:: get()
 
       Return the current value of the scale.
@@ -4947,6 +4950,9 @@ Widget classes
    text.
    Inherits from :class:`Widget` and :class:`XView`.
 
+   With a non-integer *increment*, see :ref:`numeric values and the locale
+   <tkinter-numeric-locale>`.
+
    Many of the methods take an *index* argument identifying a character in the
    spinbox's string.
    As described in the Tk ``spinbox`` manual page, *index* may be a numeric
@@ -5772,6 +5778,18 @@ Variable classes
 
       Return the value of the variable as a :class:`float`.
 
+   .. _tkinter-numeric-locale:
+
+   .. note::
+
+      A floating-point value is always parsed with a period (``.``) as the
+      decimal separator, but :class:`Spinbox`, :class:`Scale` and
+      :class:`ttk.Spinbox <tkinter.ttk.Spinbox>` format it according to the
+      ``LC_NUMERIC`` locale.  Under a locale that uses a comma they produce a
+      value that :meth:`get` cannot read, raising :exc:`TclError`.  Set
+      ``LC_NUMERIC`` to a locale that uses a period (such as ``'C'``) to avoid
+      this.
+
 
 .. class:: BooleanVar(master=None, value=None, name=None)
 
diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst
index 55ce18cf20f7c67..380b7370fe6c8d8 100644
--- a/Doc/library/tkinter.ttk.rst
+++ b/Doc/library/tkinter.ttk.rst
@@ -465,6 +465,9 @@ ttk.Spinbox
 
 .. class:: Spinbox
 
+   With a non-integer increment, see :ref:`numeric values and the locale
+   <tkinter-numeric-locale>`.
+
    .. versionadded:: 3.8
 
    .. method:: get()

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to