Prototyping interactive applications using Python and Tkinter

Introduction: Tcl, Tk and Tkinter

Tcl is a scripting language created by John Ousterhout in the 1980s. Tk is a graphical user interface toolkit based on Tcl. Tcl/Tk is available on most Unix platforms, as well as on Microsoft Windows and Apple MacOS systems. Starting with the 8.0 release, Tk offers native look and feel on all platforms.

The Tkinter module ("Tk interface") is the standard Python interface to the Tk GUI toolkit. It is a thin object-oriented layer on top of Tcl/Tk. It consists in a set of wrappers that implement Tk widgets as Python classes and provides a threadsafe mechanism which allows Python and Tcl to interact.

To use Tkinter, you don't need to write Tcl code, but in addition to the Python documentation, you will occasionally need to consult the Tcl/Tk documentation. The following references will also be useful:

The plan for today

We will start by reading these quick start notes which will tell you the basics of writing Tkinter-based applications. We will then have a look at the standard Tcl/Tk demos. Finally, we'll work on a small application: an helicase viewer.

For more information

Here are some other exercices that might be interesting to you: