@@ -72,7 +72,7 @@ Architecture
72
72
------------
73
73
74
74
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
76
76
documentation. Python's binary releases also ship an add-on module
77
77
together with it.
78
78
@@ -102,11 +102,14 @@ Ttk
102
102
Ttk is distributed as part of Tk, starting with Tk version 8.5. Python
103
103
bindings are provided in a separate module, :mod: `tkinter.ttk `.
104
104
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.
110
113
111
114
112
115
Tkinter Modules
@@ -441,39 +444,6 @@ documentation for all of these in the
441
444
inherit from).
442
445
443
446
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
-
477
447
Threading model
478
448
---------------
479
449
0 commit comments