Python GTK+ 3 Tutorial

One of the big advantages of PyGTK is that it is documented very well. Unfortunately, despite the efforts to make PyGObject as compatible to PyGTK as possible, the differences are still huge. A big portion is due to the changes between GTK+ version 2 and 3, of course. To date, you basically have to look into the GIR file or C reference manual to try to figure out how things work. Once you are familiar with the way C functions are converted to Python, you can guess most methods. For a beginner this is far from obvious, though.

During this years Desktop Summit first efforts were made to come up with a generic solution to generate API documentation for language bindings. However, the Python bindings provide additional and slightly different (mostly due to PyGTK compatibility) methods and classes. This information is not included in the API docs for C, which constitutes an additional obstacle.

To address some of this issues, especially for beginners, I started writing a tutorial that gives an introduction to writing GTK+ 3 applications in Python. My work is based on an updated version of the PyGTK tutorial, the gtkmm 3 tutorial, and the GTK+ 3 reference manual. The current version of the tutorial is available at http://python-gtk-3-tutorial.readthedocs.org (http://people.gnome.org/~sebp/pygobject-tutorial/). You’ll need at least PyGObject 2.90.3 for all examples to work correctly.

The goal is to provide an introduction to the most important widgets and concepts, rather than an API documentation. It is still far from complete, but I think it’s enough to make it available for the broader audience. More technically, it is based on Sphinx and most of the contents were copied from one of the sources mentioned above. As always, help is highly appreciated. The code currently lives in my github repository.

Avatar
Sebastian Pölsterl
Post-Doctoral Researcher

My research interests include machine learning for time-to-event analysis, non-Euclidean data, and biomedical applications.