An Introduction to Tkinter | ||
Copyright © 1997 by Fredrik Lundh <[email protected]> | ||
Updated 9 Nov 1997 |
< An Introduction to Tkinter | What's Tkinter? | Hello, Tkinter >
The Tkinter module ("Tk interface") is the standard Python interface to the Tk GUI toolkit from Sun Labs. Both Tk and Tkinter are available on most Unix platforms, as well as on Windows and Macintosh systems. Starting with the most recent release (8.0), Tk also offers native look and feel on all platforms.
Tkinter consists of a number of modules. The Tk interface is located in a binary module named _tkinter (this was tkinter in earlier versions). This module contains the low-level interface to Tk, and should never be used directly by application programmers. It is usually a shared library (or DLL), but might in some cases be statically linked with the Python interpreter.
In addition to the Tk interface module, Tkinter includes a number of Python modules located in a subdirectory to the standard library, called tkinter. The two most important modules are Tkinter itself, and a module called Tkconstants. The former automatically imports the latter, so to use Tkinter, all you need to do is to import one module:
import Tkinter
Or, more commonly:
from Tkinter import *
< An Introduction to Tkinter | What's Tkinter? | Hello, Tkinter >