Getting started with Pmw

Introduction

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

Requirements

Pmw.2.1 requires the tkinter module. It works with python version 3 and Tk version 8.

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 http://sourceforge.net/projects/blt/.

Distribution and installation

Releases of the Pmw distribution are available via http from download.sourceforge.net/pmw. This release is available as Pmw.2.1.tar.gz, released on 31 December 2020. 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 (http://www.winzip.com) 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 Pmw. You now need to put this directory somewhere python can find it, preferably in one of the standard places, such as in the site-packages directory (eg: .local/lib/python3.8/site-packages/Pmw in your home directory) or the sys.prefix directory (eg: C:\Program Files\Python\Pmw or /usr/lib/python3/dist-packages).

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/python3/dist-packages
gunzip /tmp/Pmw.2.1.tar.gz (or gzip -d /tmp/Pmw.2.1.tar.gz)
tar xvf /tmp/Pmw.2.1.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.

Documentation

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 Bjorn 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 All.py 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 All.py. 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 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 http://download.sourceforge.net/pmw/Pmw.2.1.docsrc.tar.gz . Download this file into the Pmw/Pmw_2_1 directory of the Pmw source tree. Unzip and untar the file. This will create a docsrc sub-directory of Pmw/Pmw_2_1. 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 createmanuals.py. 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_2_1 directory:

cd Pmw/Pmw_2_1
gunzip Pmw.2.1.docsrc.tar.gz
tar xvf Pmw.2.1.docsrc.tar
mv doc doc.old
cd docsrc
./createmanuals.py

If running under Unix, you will need to run the createmanuals.py 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 contribute via the Pmw discussion and announcement mailing list. 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.

Licence

The official Pmw licence (see copyright) basically lets you do anything with Pmw as long as you don't hurt anyone.

Acknowledgements

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.

If you have any comments, bugs, fixes, problems, suggestions or enhancements, please send to the Pmw discussion and announcement mailing list.

Pmw 2.1 - 31 Dec 2020 - Home