8000 bpo-42560: reorganize Tkinter docs modules section for clarity (GH-2… · python/cpython@d5dbe8b · GitHub
[go: up one dir, main page]

Skip to content

Commit d5dbe8b

Browse files
authored
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
1 parent 141c7a4 commit d5dbe8b

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
@@ -105,23 +105,13 @@ Tix
105105
Tkinter Modules
106106
---------------
107107

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

120-
import tkinter
121-
122-
Or, more often::
123112

124113
from tkinter import *
114+
from tkinter import ttk
125115

126116

127117
.. class:: Tk(screenName=None, baseName=None, className='Tk', useTk=1)
@@ -144,7 +134,10 @@ Or, more often::
144134
subsystem initialized) by calling its :meth:`loadtk` method.
145135

146136

147-
Other modules that provide Tk support include:
137+
The modules that provide Tk support include:
138+
139+
:mod:`tkinter`
140+
Main Tkinter module.
148141

149142
:mod:`tkinter.colorchooser`
150143
Dialog to let the user choose a color.
@@ -167,9 +160,35 @@ Other modules that provide Tk support include:
167160
:mod:`tkinter.simpledialog`
168161
Basic dialogs and convenience functions.
169162

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

174193
:mod:`turtle`
175194
Turtle graphics in a Tk window.

0 commit comments

Comments
 (0)
0