IdentifiantMot de passe
Mot de passe oublié ?Je m'inscris ! (gratuit)
20.1.5 How Tk and Tkinter are Related

20.1.5 How Tk and Tkinter are Related

Note: This was derived from a graphical image; the image will be used more directly in a subsequent version of this document.

From the top down:

Your App Here (Python)
A Python application makes a Tkinter call.

Tkinter (Python Module)
This call (say, for example, creating a button widget), is implemented in the Tkinter module, which is written in Python. This Python function will parse the commands and the arguments and convert them into a form that makes them look as if they had come from a Tk script instead of a Python script.

tkinter (C)
These commands and their arguments will be passed to a C function in the tkinter - note the lowercase - extension module.

Tk Widgets (C and Tcl)
This C function is able to make calls into other C modules, including the C functions that make up the Tk library. Tk is implemented in C and some Tcl. The Tcl part of the Tk widgets is used to bind certain default behaviors to widgets, and is executed once at the point where the Python Tkinter module is imported. (The user never sees this stage).

Tk (C)
The Tk part of the Tk Widgets implement the final mapping to ...

Xlib (C)
the Xlib library to draw graphics on the screen.

See About this document... for information on suggesting changes.