Wing IDE is an integrated development environment that can be used to write, test, and debug Python code that is written for the powerful wxPython cross-platform 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.

For more information on Wing IDE see the product overview. If you do not already have Wing IDE installed, download a free trial now.

To get started using Wing, refer to the tutorial in the Help menu in Wing and/or the Wing IDE Quickstart Guide.

Introduction

wxPython is a good choice for GUI developers. It currently available for MS Windows, Linux, Unix, and Mac OS X and provides native look and feel on each of these platforms.

While Wing IDE does not provide a GUI builder for wxPython, 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 wxPython:

Test Driving the Debugger

Now you're ready to try out the debugger. To do this:

Start debugging with the Start / Continue item in the Debug menu. Uncheck the Show this dialog before each run checkbox at the bottom of the dialog that appears and select OK.

The demo application will start up. If its main window doesn't come to front, bring it to front from your task bar or window manager. Try out the various demos from the tree on the left of the wxPython demo app.

Important: In earlier wxPython 2.6 versions, a change to the demo code breaks all debuggers by not setting the co_filename attribute on code objects correctly. To fix this, change the line that reads description = self.modules[modID][2] around line 804 in demo\main.py to instead read description = self.modules[modID][3] -- Wing will not stop at breakpoints until this is done.

Next open ImageBrowser.py (located in the same directory as demo.py) into Wing IDE. Set a breakpoint on the first line of runTest() by clicking on the dark grey left margin. Go into the running demo app and select More Dialogs / ImageBrowser. Wing will stop on your breakpoint.

Select Stack Data from the Tools menu. Look around the stack in the popup at the top of the window and the locals and globals shown below that for the selected stack frame. You may see some sluggishness (a few seconds) in displaying values because of the widespread use of from wx import * in wxPython code, which imports a huge number of symbols into the globals name space. This depends on the speed of your machine.

Select Debug Probe (Wing Pro only) from the Tools menu. This is an interactive command prompt that lets you type expressions or even change values in the context of the stack frame that is selected on the Debugger window when your program is paused or stopped at an exception. It is a very powerful debugging tool.

Also take a look at these tools available from the Tools menu:

Test Driving the Source Browser

Don't forget to check out Wing's powerful source browser:

Using a GUI Builder

Wing IDE doesn't currently include a GUI builder for wxPython but it can be used with other tools, such as Boa Constructor, which does provide a GUI builder but doesn't have the raw power of Wing IDE's debugger and source browser.

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.