Getting started with Pmw


This document describes how to fetch and install Pmw, and how to run the demonstrations and tests.


Pmw.1.3 requires the _tkinter and Tkinter modules. It works with python versions 1.5.2 and greater (tested up to 2.2.1) and Tk versions 8.0 and greater (tested up to 8.3.2).

If the BLT extension to Tk is present, Pmw will use the BLT busy command during modal dialogs to display a clock cursor. Also, the Pmw.Blt interface to the BLT busy, graph, stripchart, tabset and vector commands will be available. BLT versions 2.4i and greater are supported (tested up to 2.4u). You can find BLT at

Distribution and installation

Releases of the Pmw distribution are available via http from This release is available as Pmw.1.3.tar.gz, released on 6 August 2007. This is a compressed tar file.
Under Linux, Unix, etc, you will need to unpack it using tar and you may also need to use gzip or gunzip to uncompress it.
Under Microsoft Windows, you will need a program such as WinZip ( that can unpack the gzipped tar files. You may need to change the suffix of the file to .tgz for WinZip to recognise it.

This will unpack into a directory named src containing the directory Pmw and the installation utility You now need to put this directory Pmw somewhere python can find it, preferably in one of the standard places, such as in the site-packages directory (eg: /usr/lib/python2.2/site-packages/Pmw) or the sys.prefix directory (eg: C:\Program Files\Python\Pmw or /usr/lib/python2.2).

One easy way to install the Pmw directory in the site-packages directory of your installation is to use the utility.

This is done as follows:

python install (as root)


sudo python install (under Ubuntu or Mac OS X)

Alternatively, to install manually, for example under Unix, assuming you have placed the tar file in the /tmp directory, you can simply run the following commands:

cd /usr/lib/python2.2/site-packages
gunzip /tmp/Pmw.1.3.tar.gz (or gzip -d /tmp/Pmw.1.3.tar.gz)
tar xvf /tmp/Pmw.1.3.tar

If you do not have write permission for these standard directories, place the Pmw directory somewhere on your PYTHONPATH or sys.path. If this is not possible, place the Pmw directory somewhere else and add the parent directory to your PYTHONPATH or sys.path.

If you have previously installed Pmw version 0.6 or later, then the new version can share the same Pmw directory as the previous versions. You will need to perform the tar extraction in the directory containing (that is, the parent directory of) the existing Pmw directory. By default, your applications will use the most recent version of Pmw. If required, the function Pmw.setversion() can be used to specify a version to be used. See the reference manual for details. If you are no longer using the older versions, you can safely remove the corresponding subdirectories from the Pmw directory.

If you need assistance in installing BLT under Unix, please contact me ( and I will try to help. For other operating systems, such as Microsoft or Macintosh, you should try asking the python newsgroup. If anyone can give me a description of how to install BLT under other operating systems please contribute it and I will place it here.


The doc directory for each Pmw version contains all the documentation for that version of Pmw. See the local home page for a complete list of documents. The files in this directory are also available from the official Pmw home page.

An excellent tutorial and reference covering the Pmw interface to the powerful Blt graph widget, "A User's Guide to Pmw.Blt" written by Bjørn Ove Thue and Hans Petter Langtangen, is available. You can also download the full HTML document for local viewing.

Demonstrations and tests

A good way to get an overview of the functionality provided by Pmw is to run the demonstrations and tests and look at the demonstration code. To view a comprehensive demonstration of many of the features of Pmw run the script, which can be found in the demos subdirectory of each version of Pmw.

You do not have to install Pmw to run the demonstrations and tests, simply change into the appropriate directory and run the file See Demonstrations and tests for more information about running the demonstrations and tests and how to create your own.

Note that there are some bugs in later versions of BLT (at least 2.4t and 2.4u) which cause some tests of Pmw.Blt.Graph to crash with python2.0 under Linux. These tests have been commented out (until BLT is fixed).

Contributions welcome

If you create some whiz-bang megawidgets and would like to contribute them to Pmw, they will be most welcome. You should be able to get some idea of the coding style used in Pmw code by reading How to build Pmw megawidgets and by looking at the Pmw library code itself in the lib directory of each Pmw version.

If you would like to contribute a megawidget, it would be preferable if it also came with a simple demonstration and a test script. See Demonstrations and tests for information about how to create new demonstrations and tests.

Each megawidget should also have a reference manual describing its options, components and methods.

Generating the documentation

The released reference manuals are automatically generated by merging specially marked-up text with the output from megawidget query methods, such as components(), options() and componentaliases(), and various other introspective devices. If you are interested to see how the documentation is generated, you can fetch the marked-up text and the python script to convert the text to html from . Download this file into the Pmw/Pmw_1_3 directory of the Pmw source tree. Unzip and untar the file. This will create a docsrc sub-directory of Pmw/Pmw_1_3. If you want to keep the documentation which came with the Pmw distribution, rename the old doc directory. Then change directory to docsrc and run After printing lots of warnings about documentation that has not been written yet, this will create a new doc directory containing all the html documentation.

Here is an example set of commands to unpack the documentation source and regenerate the documentation, assuming you have downloaded the source in the Pmw/Pmw_1_3 directory:

cd Pmw/Pmw_1_3
gunzip Pmw.1.3.docsrc.tar.gz
tar xvf Pmw.1.3.docsrc.tar
mv doc doc.old
cd docsrc

If running under Unix, you will need to run the script with a valid DISPLAY environment variable, since it creates each megawidget and then queries it for its options, components, etc. This is because Tk (and hence Tkinter) requires a connection to an X server to run.

Future plans and bugs

The todo list contains a long list of of suggestions, bugs and enhancements for Pmw. If you are interested in doing any of these, please let the maintainer ( know. Some of the items in the todo list may be considered bugs. There are also some other problems due to idiosyncrasies in the implementation of Tk.


The official Pmw licence (see copyright) basically lets you do anything with Pmw as long as you don't hurt anyone. There is also another licence, the "Postcard Licence":

"I'd like to get a postcard from you! I'm interested in who is using Pmw, where you live and where in the world Pmw is doing it's job"

Please send me an e-mail to to get my postal address.


The initial ideas for Pmw were blatantly stolen from the itcl extensions [incr Tk] by Michael McLennan and [incr Widgets] by Mark Ulferts. Several of the megawidgets are direct translations from the itcl to python.

The base classes and most megawidgets were written by Greg McFarlane and Peter Munnings. Contributed megawidgets include: Pmw.TimeCounter by Joe VanAndel, Pmw.Group and an early version of Pmw.NoteBook by Case Roole, Pmw.ScrolledCanvas, Pmw.ScrolledFrame and another early version of Pmw.NoteBook by Joe Saltiel and Pmw.OptionMenu by Roman Sulzhyk. A big thank you to the following people for their bug reports, fixes, enhancements and suggestions: David Ascher, Robin Becker, Siggy Brentrup, Mark Colclough, Jerome Gay, Clemens Hintze, Rob Hooft Jack Jansen, Jonathan Kelly, Magnus Kessler, Matthias Klose, Andreas Kostyrka, Fredrik Lundh, Magnus Lycka, Graham Matthews, Dieter Maurer, Michael McLay, Daniel Michelson, Georg Mischler, Rob Pearson, Case Roole, Joe Saltiel, Roman Sulzhyk, Shen Wang, Chris Wright, and Guido van Rossum. Special thanks to Case Roole and Michael McLay for help with getting Pmw to work with python packages and many other nifty features. My deepest apologies if I have forgotten anyone. Please let me know.

The Pmw home page and project site is made available courtesy of SourceForge.

The current maintainer is Greg McFarlane. I monitor the Pmw discussion and announcement mailing list so please send any problems, comments, suggestions or enhancements to the list. You may also contact me directly at

Pmw 1.3 - 6 Aug 2007 - Home