Skip to content

Commit 4d1e74f

Browse files
bpo-42560: reorganize Tkinter docs modules section for clarity (GH-27840)
- move description of internal modules (_tkinter and tkinter.constants) from section intro to list of additional modules at end of section, as not most important info - added missing ttk and tix here - emphasized up front that most apps will need tkinter and ttk (cherry picked from commit d5dbe8b) Co-authored-by: Mark Roseman <mark@markroseman.com>
1 parent 61ecd3e commit 4d1e74f

File tree

1 file changed

+36
-17
lines changed

1 file changed

+36
-17
lines changed

Doc/library/tkinter.rst

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,13 @@ Tix
118118
Tkinter Modules
119119
---------------
120120

121-
Most of the time, :mod:`tkinter` is all you really need, but a number of
122-
additional modules are available as well. The Tk interface is located in a
123-
binary module named :mod:`_tkinter`. This module contains the low-level
124-
interface to Tk, and should never be used directly by application programmers.
125-
It is usually a shared library (or DLL), but might in some cases be statically
126-
linked with the Python interpreter.
127-
128-
In addition to the Tk interface module, :mod:`tkinter` includes a number of
129-
Python modules, :mod:`tkinter.constants` being one of the most important.
130-
Importing :mod:`tkinter` will automatically import :mod:`tkinter.constants`,
131-
so, usually, to use Tkinter all you need is a simple import statement::
121+
Support for Tkinter is spread across several modules. Most applications will need the
122+
main :mod:`tkinter` module, as well as the :mod:`tkinter.ttk` module, which provides
123+
the modern themed widget set and API::
132124

133-
import tkinter
134-
135-
Or, more often::
136125

137126
from tkinter import *
127+
from tkinter import ttk
138128

139129

140130
.. class:: Tk(screenName=None, baseName=None, className='Tk', useTk=1)
@@ -157,7 +147,10 @@ Or, more often::
157147
subsystem initialized) by calling its :meth:`loadtk` method.
158148

159149

160-
Other modules that provide Tk support include:
150+
The modules that provide Tk support include:
151+
152+
:mod:`tkinter`
153+
Main Tkinter module.
161154

162155
:mod:`tkinter.colorchooser`
163156
Dialog to let the user choose a color.
@@ -180,9 +173,35 @@ Other modules that provide Tk support include:
180173
:mod:`tkinter.simpledialog`
181174
Basic dialogs and convenience functions.
182175

176+
:mod:`tkinter.ttk`
177+
Themed widget set introduced in Tk 8.5, providing modern alternatives
178+
for many of the classic widgets in the main :mod:`tkinter` module.
179+
180+
Additional modules:
181+
182+
:mod:`_tkinter`
183+
A binary module that contains the low-level interface to Tcl/Tk.
184+
It is automatically imported by the main :mod:`tkinter` module,
185+
and should never be used directly by application programmers.
186+
It is usually a shared library (or DLL), but might in some cases be
187+
statically linked with the Python interpreter.
188+
189+
:mod:`idlelib`
190+
Python's Integrated Development and Learning Environment (IDLE). Based
191+
on :mod:`tkinter`.
192+
193+
:mod:`tkinter.constants`
194+
Symbolic constants that can be used in place of strings when passing
195+
various parameters to Tkinter calls. Automatically imported by the
196+
main :mod:`tkinter` module.
197+
183198
:mod:`tkinter.dnd`
184-
Drag-and-drop support for :mod:`tkinter`. This is experimental and should
185-
become deprecated when it is replaced with the Tk DND.
199+
(experimental) Drag-and-drop support for :mod:`tkinter`. This will
200+
become deprecated when it is replaced with the Tk DND.
201+
202+
:mod:`tkinter.tix`
203+
(deprecated) An older third-party Tcl/Tk package that adds several new
204+
widgets. Better alternatives for most can be found in :mod:`tkinter.ttk`.
186205

187206
:mod:`turtle`
188207
Turtle graphics in a Tk window.

0 commit comments

Comments
 (0)