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

Skip to content

Commit 986750b

Browse files
bpo-42560: reorganize Tkinter docs modules section for clarity (GH-27840) (GH-27895)
- 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 e74cf86 commit 986750b

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
@@ -67,23 +67,13 @@ installed, so you can read the Tcl/Tk documentation specific to that version.
6767
Tkinter Modules
6868
---------------
6969

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

82-
import tkinter
83-
84-
Or, more often::
8574

8675
from tkinter import *
76+
from tkinter import ttk
8777

8878

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

10898

109-
Other modules that provide Tk support include:
99+
The modules that provide Tk support include:
100+
101+
:mod:`tkinter`
102+
Main Tkinter module.
110103

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

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

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

0 commit comments

Comments
 (0)
0