Creating GUIs with Python on RISC OS

Release: 16/10/2001

Introduction

I have been experimenting with creating graphical user interfaces (GUIs) using Python for some time now, adding features to my class framework as I need them and tidying it up as required. The result is hopefully a fairly straightforward set of classes to use, although the internal workings could be made simpler.

The aim is to produce a system which allows objects to be created within a hierarchy, with windows containing objects (which can themselves contain objects) in a tree structure. User input and messages are passed to the relevant objects via their parents or containers in the tree and not directly to the objects themselves. This is somewhat at odds to the way the RISC OS window manager usually deals with applications, especially with features such as menus, leading to a less-than-clean internal structure to the library. Nonetheless, it should still be possible to create flexible, interactive applications which utilise the functionality of available Python libraries (standard and third party) and the RISC OS window manager.

The final form of the library is not yet fixed and many internal changes may be needed to provide new functionality. These changes will quite probably break existing applications written with the library.

Features and problems

The features supported by this release are as follows:

Hierarchical window and object structure
Windows contain objects which can themselves contain objects, although there are limitations to the amount of layers that one can add.
Shared objects
Objects may be assigned more than one parent so that they appear in more than one window at a time. This is useful for providing multiple views onto a document, for example.
Window scale factors
Windows may ask their child objects to redraw themselves using scale factors local to each window. This allows each view onto a document to be displayed on a different scale.
Message handling
Messages from the window manager can be offered to windows and their objects providing support for features such as drag and drop loading and saving with very little effort on the part of the application developer.

Related resources

A simple tutorial for writing applications using the library is available.

Demonstrations and examples of use are available to assist in understanding how to create applications.


A simple WWW browser has been written to test some of the features of the library. Although quite contrived in many respects, it demonstrates object sharing and scaling in multiple document views.

License

Copyright (C) 2001 David Boddie

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Acknowledgements

This project would not have been possible without the efforts of the following people:

Chris Stretch, Laurence Tratt and Dietmar Schwertberger
The various people who have ported Python to RISC OS over the years.
Guido van Rossum and the Python Software Foundation
The author and current guardians of the Python language.
Paul Boddie
Provided some interesting ideas for a desktop C++ class library back in 1995.

David Boddie
david@boddie.org.uk