# Python Programming/GUI Programming

| Previous: Sockets | Index | Next: CGI interface |
There are various GUI toolkits usable from Python.
Very productive are true GUI-builders, where the programmer can arrange the GUI window and other components such as database by using the mouse only in an intuitive fashion like in Windows Delphi 2.0. Very little typing is required. For python, only Boa Constructor follows this paradigm. WXglade and Qt-designer, monkey studio etc. come somewhat near but remain incomplete.
Disadvantages with the following kits described below are:
* Difficult deployment - the apps won't run on a particular GNU-Linux installation without major additional work
* breakage - apps won't work due to bit-rot.

## Tkinter

Tkinter is a Python wrapper for Tcl/Tk providing a cross-platform GUI toolkit. On Windows, it comes bundled with Python; on other operating systems, it can be installed. The set of available widgets is smaller than in some other toolkits, but since Tkinter widgets are extensible, many of the missing compound widgets can be created using the extensibility, such as combo box and scrolling pane.
A minimal example:
Main chapter: Tkinter.
Links:
* 24.1. Tkinter — Python interface to Tcl/Tk, python.org
* Tkinter 8.5 reference: a GUI for Python, infohost.nmt.edu; the same as pdf
* An Introduction to Tkinter, effbot.org

## PyGTK

See also book PyGTK For GUI Programming
PyGTK provides a convenient wrapper for the GTK+ library for use in Python programs, taking care of many of the boring details such as managing memory and type casting. The bare GTK+ toolkit runs on Linux, Windows, and Mac OS X (port in progress), but the more extensive features — when combined with PyORBit and gnome-python — require a GNOME install, and can be used to write full featured GNOME applications.
Home Page

## PyQt

PyQt is a wrapper around the cross-platform Qt C++ toolkit. It has many widgets and support classes supporting SQL, OpenGL, SVG, XML, and advanced graphics capabilities. A PyQt hello world example:
PyQt is a set of bindings for the cross-platform Qt application framework. PyQt v4 supports Qt4 and PyQt v3 supports Qt3 and earlier.

## wxPython

Bindings for the cross platform toolkit wxWidgets. WxWidgets is available on Windows, Macintosh, and Unix/Linux.
* wxPython

## Dabo

Dabo is a full 3-tier application framework. Its UI layer wraps wxPython, and greatly simplifies the syntax.
* Dabo

## pyFltk

pyFltk is a Python wrapper for the FLTK, a lightweight cross-platform GUI toolkit. It is very simple to learn and allows for compact user interfaces.
The "Hello World" example in pyFltk looks like:

## Other Toolkits

* PyKDE - Part of the kdebindings package, it provides a python wrapper for the KDE libraries.
* PyXPCOM provides a wrapper around the Mozilla XPCOM component architecture, thereby enabling the use of standalone XUL applications in Python. The XUL toolkit has traditionally been wrapped up in various other parts of XPCOM, but with the advent of libxul and XULRunner this should become more feasible. These days, nobody uses PyXPCOM for very good reasons: PyXPCOM gives one dead links and outdated incompatible firefox extensions.

## External links

* Graphic User Interface FAQ, python.org
* An excerpt from Chapter 20: GUI Development, from Python Programming on Win32, onlamp.com, by Mark Hammond, Andy Robinson; covers Tkinter, PythonWin and wxPython
* Google Ngram Viewer: Tkinter, wxPython, wxWidgets, PyGTK, PyQt
| Previous: Sockets | Index | Next: CGI interface |