Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions Doc/library/tkinter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ demonstrating a simple Tk interface, letting you know that :mod:`!tkinter` is
properly installed on your system, and also showing what version of Tcl/Tk is
installed, so you can read the Tcl/Tk documentation specific to that version.

Tkinter supports a range of Tcl/Tk versions, built either with or without
Tkinter supports a range of Tcl/Tk versions, which must be built with
thread support.
Tcl/Tk 8.5.12 is the minimum supported version; the official Python binary
release bundles Tcl/Tk 9.0.
Expand All @@ -27,6 +27,9 @@ supported versions.
.. versionchanged:: 3.11
Support for Tcl/Tk versions older than 8.5.12 was removed.

.. versionchanged:: next
Support for Tcl/Tk built without thread support was removed.

Tkinter is not a thin wrapper, but adds a fair amount of its own logic to
make the experience more pythonic. This documentation will concentrate on these
additions and changes, and refer to the official Tcl/Tk documentation for
Expand Down Expand Up @@ -476,18 +479,11 @@ interpreter will fail.

A number of special cases exist:

* Tcl/Tk libraries built without thread support are now rare: Tcl/Tk 9.0 (the
bundled version) is always thread-aware, so this case only arises with some
older 8.x builds. When the library is not thread-aware,
:mod:`!tkinter` calls the library from the originating Python thread, even
if this is different than the thread that created the Tcl interpreter. A global
lock ensures only one call occurs at a time.

* While :mod:`!tkinter` allows you to create more than one instance of a :class:`Tk`
object (with its own interpreter), all interpreters that are part of the same
thread share a common event queue, which gets ugly fast. In practice, don't create
more than one instance of :class:`Tk` at a time. Otherwise, it's best to create
them in separate threads and ensure you're running a thread-aware Tcl/Tk build.
them in separate threads.

* Blocking event handlers are not the only way to prevent the Tcl interpreter from
reentering the event loop. It is even possible to run multiple nested event loops
Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,12 @@ Build changes

(Contributed by Russell Keith-Magee in :gh:`159385`.)

* :mod:`tkinter` now requires Tcl/Tk built with thread support.
This only affects Tcl/Tk 8, since Tcl/Tk 9 is always built with
thread support.

(Contributed by Michiel de Hoon in :gh:`140494`.)


.. _whatsnew316-apple-platforms:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Require that Tcl is always built with thread support.
This requirement only affects Tcl 8.x, as Tcl 9.x is always thread-enabled.
Loading
Loading