Wingware Python IDE

The Intelligent Development Environment for Python Programmers

Wing IDE is an integrated development environment that can be used to
edit, test, and debug Python code that is written for PyGTK and GTK+, a
mature open source GUI development toolkit. Wing provides auto-completion,
call tips, a powerful debugger, and many other features that help you write,
navigate, and understand Python code.

Introduction

PyGTK is currently available for Linux/Unix, MS 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 IDE is itself written using PyGTK.

While Wing IDE 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 IDE for use with
PyGTK:

Install GTK and PyGTK. If you are on Linux, you may already have one
or both installed, or you may be able to install them using your
distribution's package manager. Otherwise, check out the gtk website
and pygtk website.

Start Wing from the Start menu on Windows, the Finder or OS X, or by
typing wing5.1 on the command line on Linux other Posix systems.
Once Wing has started, you may want to switch to reading this How-To from
the Help menu. This will add links to the functionality of the application.

Select Show Python Environment from the Source menu and if the Python version
reported there doesn't match the one you're using with PyGTK, then select
Project Properties from the Project menu and use the
Python Executable field
to select the correct Python version.

Add some files to your project, and set the main entry point with SetMainDebugFile in the Debug menu.

Save your project to disk. Use a name ending in .wpr.

You should now be able to debug your PyGTK application from within Wing.
If you see ImportErrors on the PyGTK modules, you will need to add
Python Path
in the Debug tab of Project Properties,
accessed from the Project menu.

Auto-completion and Source Assistant

To obtain auto-completion options and call signature information in Wing IDE
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:

Run as described within the script to produce a *.pi file for each
*.so or *.pyd file in the PyGTK sources.

Copy these *.pi files into the installed copy of PyGTK, so they sit
next to the compiled *.so or *.pyd extension module file that they
describe.

Wing should now provide auto-completion and (in Wing IDE Pro) Source Assistant information
when you importgtk and type gtk. in the editor.

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 IDE 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 IDE 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

Building GTK from sources can be a challenge. Wingware has developed
some build support scripts which we can provide on request. We also
have patches that allow GTK to be relocated after building on Linux/Unix.

Native look and feel on Windows is provided by the gtk-wimp
theme. If you plan to deploy on Windows, you may wish to contact
us to obtain our latest performance patches for GTK on Windows.

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.