8000 bpo-42560: simplify/merge architecture info in Tkinter docs (GH-27839) · python/cpython@e41912c · GitHub
[go: up one dir, main page]

Skip to content

Commit e41912c

Browse files
rosemanambvE-Paine
authored
bpo-42560: simplify/merge architecture info in Tkinter docs (GH-27839)
Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
1 parent dcbf7ff commit e41912c

File tree

1 file changed

+9
-39
lines changed

1 file changed

+9
-39
lines changed

Doc/library/tkinter.rst

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Architecture
7272
------------
7373

7474
Tcl/Tk is not a single library but rather consists of a few distinct
75-
modules, each with a separate functionality and its own official
75+
modules, each with separate functionality and its own official
7676
documentation. Python's binary releases also ship an add-on module
7777
together with it.
7878

@@ -102,11 +102,14 @@ Ttk
102102
Ttk is distributed as part of Tk, starting with Tk version 8.5. Python
103103
bindings are provided in a separate module, :mod:`tkinter.ttk`.
104104

105-
Tix
106-
`Tix <https://core.tcl.tk/jenglish/gutter/packages/tix.html>`_ is an older
107-
third-party Tcl package, an add-on for Tk that adds several new widgets.
108-
Python bindings are found in the :mod:`tkinter.tix` module.
109-
It's deprecated in favor of Ttk.
105+
Internally, Tk and Ttk use facilities of the underlying operating system,
106+
i.e., Xlib on Unix/X11, Cocoa on macOS, GDI on Windows.
107+
108+
When your Python application uses a class in Tkinter, e.g., to create a widget,
109+
the :mod:`tkinter` module first assembles a Tcl/Tk command string. It passes that
110+
Tcl command string to an internal :mod:`_tkinter` binary module, which then
111+
calls the Tcl interpreter to evaluate it. The Tcl interpreter will then call into the
112+
Tk and/or Ttk packages, which will in turn make calls to Xlib, Cocoa, or GDI.
110113

111114

112115
Tkinter Modules
@@ -441,39 +444,6 @@ documentation for all of these in the
441444
inherit from).
442445

443446

444-
How Tk and Tkinter are Related
445-
------------------------------
446-
447-
From the top down:
448-
449-
Your App Here (Python)
450-
A Python application makes a :mod:`tkinter` call.
451-
452-
tkinter (Python Package)
453-
This call (say, for example, creating a button widget), is implemented in
454-
the :mod:`tkinter` package, which is written in Python. This Python
455-
function will parse the commands and the arguments and convert them into a
456-
form that makes them look as if they had come from a Tk script instead of
457-
a Python script.
458-
459-
_tkinter (C)
460-
These commands and their arguments will be passed to a C function in the
461-
:mod:`_tkinter` - note the underscore - extension module.
462-
463-
Tk Widgets (C and Tcl)
464-
This C function is able to make calls into other C modules, including the C
465-
functions that make up the Tk library. Tk is implemented in C and some Tcl.
466-
The Tcl part of the Tk widgets is used to bind certain default behaviors to
467-
widgets, and is executed once at the point where the Python :mod:`tkinter`
468-
package is imported. (The user never sees this stage).
469-
470-
Tk (C)
471-
The Tk part of the Tk Widgets implement the final mapping to ...
472-
473-
Xlib (C)
474-
the Xlib library to draw graphics on the screen.
475-
476-
477447
Threading model
478448
---------------
479449

0 commit comments

Comments
 (0)
0