Skip to content

Commit 3a0df80

Browse files
rosemanmiss-islington
authored andcommitted
bpo-42560: reorganize Tkinter docs modules section for clarity (pythonGH-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 d006392 commit 3a0df80

1 file changed

Lines changed: 36 additions & 17 deletions

File tree

‎Doc/library/tkinter.rst‎

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,13 @@ installed, so you can read the Tcl/Tk documentation specific to that version.
6868
Tkinter Modules
6969
---------------
7070

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

83-
import tkinter
84-
85-
Or, more often::
8675

8776
from tkinter import *
77+
from tkinter import ttk
8878

8979

9080
.. class:: Tk(screenName=None, baseName=None, className='Tk', useTk=1)
@@ -107,7 +97,10 @@ Or, more often::
10797
subsystem initialized) by calling its :meth:`loadtk` method.
10898

10999

110-
Other modules that provide Tk support include:
100+
The modules that provide Tk support include:
101+
102+
:mod:`tkinter`
103+
Main Tkinter module.
111104

112105
:mod:`tkinter.colorchooser`
113106
Dialog to let the user choose a color.
@@ -130,9 +123,35 @@ Other modules that provide Tk support include:
130123
:mod:`tkinter.simpledialog`
131124
Basic dialogs and convenience functions.
132125

126+
:mod:`tkinter.ttk`
127+
Themed widget set introduced in Tk 8.5, providing modern alternatives
128+
for many of the classic widgets in the main :mod:`tkinter` module.
129+
130+
Additional modules:
131+
132+
:mod:`_tkinter`
133+
A binary module that contains the low-level interface to Tcl/Tk.
134+
It is automatically imported by the main :mod:`tkinter` module,
135+
and should never be used directly by application programmers.
136+
It is usually a shared library (or DLL), but might in some cases be
137+
statically linked with the Python interpreter.
138+
139+
:mod:`idlelib`
140+
Python's Integrated Development and Learning Environment (IDLE). Based
141+
on :mod:`tkinter`.
142+
143+
:mod:`tkinter.constants`
144+
Symbolic constants that can be used in place of strings when passing
145+
various parameters to Tkinter calls. Automatically imported by the
146+
main :mod:`tkinter` module.
147+
133148
:mod:`tkinter.dnd`
134-
Drag-and-drop support for :mod:`tkinter`. This is experimental and should
135-
become deprecated when it is replaced with the Tk DND.
149+
(experimental) Drag-and-drop support for :mod:`tkinter`. This will
150+
become deprecated when it is replaced with the Tk DND.
151+
152+
:mod:`tkinter.tix`
153+
(deprecated) An older third-party Tcl/Tk package that adds several new
154+
widgets. Better alternatives for most can be found in :mod:`tkinter.ttk`.
136155

137156
:mod:`turtle`
138157
Turtle graphics in a Tk window.

0 commit comments

Comments
 (0)