Home > Articles > Open Source > Python

  • Print
  • + Share This

Pythonwin

Pythonwin is free software, written by Mark Hammond, and now part of the ActiveState's Active Python release. It can still be downloaded separately. The bundling of IDEs complete with a Python interpreter and a small selection of the standard libraries seems to be a trend in the Windows world, because PythonWorks is also doing this. Anyway, you get both the bindings to MFC and the Pythonwin IDE when you download the package. Pythonwin is available for every current version of Python: 1.5.2, 1.6, and the 2.0 beta. I used the version for Python 1.6.

Because Pythonwin uses the standard Microsoft GUI elements, it conforms very closely to the Windows UI standards (see Figure 9). I find this to be a good thing, as anyone who is used to working with Windows will be able to get up to speed quickly.

Figure 9

Pythonwin's UI

Pythonwin looks a lot like any other IDE for Windows, like the Visual C++ IDE. On the left, there is a source browser; on the right is an MDI area where editor windows, debugger windows, and the Python shell can be opened. There are two toolbars: one with standard functions, and one with debugging buttons. A little bug is that Pythonwin doesn't remember the positions of the toolbars, and insists on placing them in two rows, instead of one.

Editor

The Pythonwin editor is the Windows version of Scintilla. Scintilla offers everything you might expect from a Python editor, like smart indenting, folding, and syntax highlighting. In addition, the editor window can be split in two, making for easy comparisons, and a service class browser panel can be opened on the left of the editor window. The compact layout of these panels, combined with an MDI interface, makes it easy to work on a large number of files at the same time.

The editor is quite configurable through dialog windows. If you want Emacs keybindings, you'll have to edit a configuration file, but you can set margin width, SourceSafe integration, and a lot of visible attributes from the GUI.

Pythonwin was one of the first Python IDEs to support autocompletion, inconsistent indentation warning, and call tips, and does it reasonably well considering that it is extremely difficult to implement due to Python's weakly typed nature. You can also check your code without running it for syntactic correctness.

Source Browsers

Pythonwin actually has two source browsers: one for modules on the Python path, and one for the file that's currently being edited. You can't easily add paths to the Python path without actually changing the global definition of the Python path.

The browsers are dependable and serviceable, but do not offer any advanced features. You don't get to see a preview of the code, docstrings, or even the arguments to the functions of a class. In the current version, functions defined outside class definitions are shown, which is a marked improvement upon earlier versions.

Project Handling

Pythonwin doesn't offer any form of project management.

Debugger

The debugger has improved a lot compared to earlier versions, and is quite usable. Upon starting a script, you get to choose from running without debug, single-stepping, running in the debugger, or running and seeing a post-mortem of unhandled exceptions. Insight in variable values is good, too. You can't edit your code while running in the debugger.

GUI Handling

Apart from the fact that Pythonwin comes with its own GUI library, it doesn't offer any help with the construction of GUIs—there's no dialog designer, for instance.

Extras

There's a Python shell window for those quick one-liners, which can be docked to the main window, too. Docking does take some dexterity, though. The shell window shows the output of running scripts. There's also a COM browser for those working with the Win32 extensions.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.