Overview

PyGTK

Original authors: James Henstridge <james@daa.com.au>
Johan Dahlin <johan@gnome.org>
Current maintainers: Gustavo J A M Carneiro <gjc@gnome.org>
Paul Pogonyshev <pogonyshev@gmx.net> Gian Mario Tagliaretti <gianmt@gnome.org>

This archive contains modules that allow you to use gtk in Python programs. At present, it is a fairly complete set of bindings. Despite the low version number, this piece of software is quite useful, and is usable to write moderately complex programs. (see the examples directory for some examples of the simpler programs you could write).

If you have any enhancements or bug reports, please file them in bugzilla at:

http://bugzilla.gnome.org/enter_bug.cgi?product=pygtk

If you have a patch, file the bug first and then use the "create new attachment" link on the bug's info page. My preferred format for patches is unified diff format (ie. diff -u). Please don't send me diffs which don't have any context, as these make it very difficult to see what the patch does.

New Versions

New versions of this package can be found at:
http://ftp.gnome.org/pub/GNOME/sources/pygtk/

Mailing list

There is a mailing list for pygtk. You can subscribe to it through the web interface:

http://www.daa.com.au/mailman/listinfo/pygtk

Requirements

  • C compiler (GCC and MSVC supported)
  • Python 2.3.5 or higher
  • PyGObject 2.12.1 or higher
  • Glib 2.8.0 or higher
  • GTK+ 2.8.0 or higher (optional) or GTK+ 2.10.0 or higher for 2.10 API GTK+ 2.12.0 or higher for 2.12 API GTK+ 2.14.0 or higher for 2.14 API GTK+ 2.16.0 or higher for 2.16 API
  • libglade 2.5.0 or higher (optional)
  • pycairo 1.0.2 or higher (optional)
  • numpy (optional)

This release is supporting the following GTK+ releases:

2.8.x 2.10.x 2.12.x 2.14.x 2.16.x 2.18.x

To include support for the 2.10 API you'll need GTK+ 2.10.0 etc.

Compilation

PyGTK uses the standard autotools for the build infrastructure. To build, it should be as simple as running:

$ ./configure --prefix=<prefix where python is installed> $ make $ make install

To build the reference documentation, supply the argument "--enable-docs" to configure.

If your Python interpreter isn't in the path, or is not called "python", you can set the PYTHON environment variable to the full path of the interpreter:

$ PYTHON=/prefix/bin/python $ export PYTHON

If configure can't find GTK+, you may need to set the PKG_CONFIG_PATH environment variable to help it find the libraries.

The "make install" target will generate normal and optimised bytecode for all the .py files.

Note. If you're installing to another prefix than the one where python is installed you'll need to set the PYTHONPATH variable to the $prefix/lib/pythonX.Y/site-packages directory created by the PyGTK installation.

Upgrading from 0.6.x

The API has changed a fair bit compared to the 0.6.x releases of pygtk in response to feedback from the mailing list. The main changes are:

  • no low level procedural interface. The extension now implements the object oriented API directly, rather than layering it on top of a procedural API.
  • class names have been shortened. Eg. instead of gtk.GtkWindow, we now have gtk.Window.
  • GDK classes and functions have been moved to the "gtk.gdk" module.
  • the GTK and GDK modules have been removed, with their constants being moved into the "gtk" and "gtk.gdk" modules.

Tests

After having compiled and installed pygtk, you may want to test them. There are a number of example programs available in the examples/ subdirectory.

Getting Help

If you have questions about programming with PyGTK, you might want to send a message to the mailing list (information on subscribing is above). Alternatively, your question may be answered in the FAQ:

http://www.async.com.br/faq/pygtk/?req=index