Wing is a Python IDE that can be used to develop, test, and debug Python code written for PyGTK and GTK+, an open source GUI development toolkit. Two versions of Wing are appropriate for use with this document: Wing Pro is the full-featured Python IDE for professional programmers, and Wing Personal is a free alternative with reduced feature set.

If you do not already have Wing installed, download it now.

This document describes how to configure Wing for PyGTK. To get started using Wing as your Python IDE, please refer to the tutorial in Wing's Help menu or read the Quickstart Guide.

Introduction

PyGTK is currently available for Linux/Unix, Windows, and Mac OS X (requires X11 Server). Like PyQt and unlike wxPython, PyGTK runs on the same (GTK-provided) widget implementations on all platforms. Themes can be used to approximate the look and behavior of widgets on the native OS. It is also possible to display native dialogs like the Windows file and print dialogs along side GTK windows. While PyGTK does not offer perfect native look and feel, its provides excellent write-once-works-anywhere capability even in very complex GUIs. Wing is itself written using PyGTK.

Other advantages of PyGTK include: (1) high quality anti-aliased text rendering, (2) powerful signal-based architecture that, among other things, allows subclassing C classes in Python, (3) multi-font text widget with embeddable sub-widgets, (4) model-view architecture for list and tree widgets, and (5) a rich collection of widgets and stock icons.

While Wing does not currently provide a GUI builder for PyGTK, it does provide the most advanced capabilities available for the Python programming language and it can be used with other available GUI builders, as described below.

Installation and Configuration

Take the following steps to set up and configure Wing for use with PyGTK:

Auto-completion and Source Assistant

To obtain auto-completion options and call signature information in Wing Pro's Source Assistant, you may need to run a script that converts from PyGTK's defs files into Python interface files that Wing's source analyser can read. This is only necessary if you are working with PyGTK significantly different than version 2.7.4, because Wing ships with pre-built interface information for PyGTK 2.7.4. If you do need to build interface files, do so as follows:

With newer PyGTK versions, it may be necessary to make modifications to the pygtk_to_pi.py script to track changes in the nature of the source base.

Using a GUI Builder

Wing doesn't currently include a GUI builder for PyGTK but it can be used with other tools, such as glade.

To use an external GUI builder, configure Wing to automatically reload files that are altered by the GUI builder. This is done in Preferences in the Files / Reloading area.

Then you can run Wing and your GUI builder at the same time, working with both in an almost seamless manner.

A Caveat: Because Python lends itself so well to writing data-driven code, you may want to reconsider using a GUI builder for some tasks. In many cases, Python's introspection features make it possible to write generic GUI code that you can use to build user interfaces on the fly based on models of your data and your application. This can be much more efficient than using a GUI builder to craft individual menus and dialogs by hand. In general hand-coded GUIs also tend to be more maintainable.

Details and Notes

Unfortunately not all of our patches have been merged into the current GTK sources, although we have contributed patches in all cases so they can be retrieved from the source forge bug tracker as well.