Python comes with a feature that is rarely shipped with a programming language: a built-in graphical user interface (GUI) library.
Python ships with a working version of the Tk
widgets toolkit, which can be controlled through the tkinter
module provided by the standard library.
The Tk
toolkit actually is used through a simple language called Tcl
. All Tk
widgets can be controlled through the Tcl
commands.
Most of these commands are very simple, and take the following form:
classname widgetid options
For example, something such as the following would lead to a button (identified asmybutton
) with a red "click here"
text:
button .mybutton -fg red -text "click here"
As those commands are usually relatively simple, Python ships with a built-in Tcl
interpreter and uses it to drive the Tk
widgets.
Nowadays, nearly everyone, even the more hardcore computer users, are used to relying on GUIs for many of their tasks, especially for simple applications that require basic interactions, such as...