SourceForge Logo

 

PAGE - Python Automatic GUI Generator - Version 2.3f

  Short Description
  Systems Supported
  Recent Changes
      Changes in 2.3f
      Changes in 2.3e
      Changes in 2.3d
      Changes in 2.3b
      Changes in 2.3a
      Changes in 2.3
      Changes in 2.2c
      Changes in version 2.2b
      Changes in version 2.2a
      The biggest changes going to version 2.2
  Installation
  Documentation
  Download
  Other projects to visit
  Some Elisp that makes EMACS a better Python IDE
    Extensions to python-mode.el
    Inserting python debugging print statements
    pycomplete
    Pymacs
  Small offerings for your consideration.
    Some things I wish that I had found.
    Extensions to Visual Regexp
      Vrex - Visual regexp written in Python
    Digital Photo Album
    Refocus plugin for The Gimp.
    Adages that have served me well
  Author

Short Description

PAGE is an automatic GUI generator which bears a resemblance to Visual Basic. It allows one to easily create GUI window containing a selection of Tk and Tix widgets and bind actions associated with events in those widgets with new version has a one line change to work with Tcl/Tk 8.4 and Tix 8.1.4. There is a straight-forward, visual paradigm.

It is a Tcl/Tk/Tix program that generates a Python module that realizes the desired GUI. Further, it supports rework in that one can generate a Python GUI module, debug it in the Python space, and yet be able to return to the Tcl/Tk realm to modify or update the appearance of the GUI or change the bindings on the widgets.

PAGE is not an end-all, be-all tool, but rather one that attempts to ease the burden on the Python programmer. It is aimed at the user who will put up with a less-than-general GUI capability in order to get an easily generated GUI. It is a helper tool. It does not build an entire application but rather is aimed at building a single GUI window.

I have included within this project python-mode extensions which I wrote to enhance emacs as a Python IDE. They may be downloaded from the Summary Page.

Systems Supported

Currently PAGE and the resulting GUI windows run on sn

It is important to know that a version of PAGE will require particular versions of Python, Tcl/Tk, and Tix. You really better stick to the recommended versions. PAGE - 2.2 is meant to work with Python - 2.2. The name is NOT meant to suggest that PAGE is up to the same level of development or sophistication that characterizes Python. It is only menat clarify the relationship of the versions involved. For fixes or enhancements I will add alphabetic extensions to the PAGE version designation. The latest version is 2.3 and is intended to run with Python 2.3 and Tcl/Tk 8.4. You should probably use the latest versions of all these Tix.

Software versions utilized to test PAGE 2.3 are:

Tk Widgets supported:

Tix Widgets supported:

Other features:

Recent Changes

Changes in 2.3f

Changes in 2.3e

Changes in 2.3d

Changes in 2.3b

Changes in 2.3a

In creating a new program for my own use, I discovered that there was an additional unsupported command from an earlier version of Tcl/Tk and that is my correction here.

Changes in 2.3

Several people contacted me about using PAGE with Python 2.3 and/or Tcl/Tk. It turns out that no changes are required to run PAGE with the newest version of Python (version 2.3.3, is the version that I am now running. However, there was one line required to run with Tcl/Tk 8.4.

Tcl/Tk 8.4 threw in a backward incompatibility that I did not handle. So, the last line in page.tcl is changed from:

vTcl:main $argc $argv
to
catch {tk::unsupported::ExposePrivateCommand tkTextInsert}

vTcl:main $argc $argv

This change is required for running under Tcl/Tk 8.4 but will not prevent it from running under earlier versions of Tcl/Tk.

I was hoping to put out a new version with a single change but I discovered a hitherto unknown bug in PAGE dealing with the transformation of Python functions generated in PAGE. Then there was the temptation to improve the Python colorization and to add a menu item for generating python code to the main menu bar and so I did those things.

Changes in 2.2c

  • Improved the documentation.

    Changes in version 2.2b

    Changes in version 2.2a

    The biggest changes going to version 2.2

    The really important changes that I tout above were made people other than myself. Many thanks.

    Installation

    Installation got much easier with Python 2.2. The main improvements were (1) Python now supports tix with all the widgets that I like to use so that it is no longer necessary to modify any of the Python installation under Linux and (2) Tix was improved to include the WnDefaults package which makes it no longer desirable to mess around with TkoptionsDB and one still gets GUI's that look good within several different environments.

    Installation remains something of a fiddle because one must have Tcl/Tk, Tix, and Python. Python - 2.3 includes Tcl/Tk libraries necessary for tkinter, but that support is not enough for running full tcl scripts which is what PAGE is. Therefore, you need to install the full blown Tcl/Tk and Tix. Please use the versions Python and Tix that I have used. I have used the latest versions of all three components. That will mean that you must:

    Installation is now (Dec. 2003) much easier under Linux than ever before because both Mandrake 9.2 and Debian come with packages for Tcl/Tk 8.4 and Tix 8.1. I found that PAGE 2.3 works just fine under Mandrake 9.2; I was not necessary to fiddle at all with Tcl/Tk or Tix. When I first tried Debian, I found that while all the packages were there so were problems. Later package updates corrected some of the problems but left others. I had no problems when I built and installed Tcl/Tk 8.4.5 and Tix 8.1.4 from source. The way to tell if your Linux system properly supports Tix is see if the command:

    tixwish /usr/local/lib/tix8.1/demos/tixwidgets.tcl
    
    yields a working demonstration. I expect future packages for Debian to work as well as what I can easily build from source. So if you have either of those systems merely use the normal installation procedures to install Tcl/Tk and Tix. I would hope that other recent releases of Linux also have up-to-date Tix and Tcl/Tk packages.

    If your Linux distribution does not include an up-to-date version of Tix, then you will have to install it from the sources. While that is a bit of a fiddle, it is not tricky or lengthly and it is well documented in the Tix source file. As part of the procedure you will need to have sources for Tcl/Tk. These are available at http://www.tcl.tk/software/tcltk/download84now.html. Installing PAGE is just a matter expanding the tgz file in Linux and making sure that the correct paths are set in the pg script.

    Installation is not difficult on Windows. I was unable to find an up-to-date binary package for installing Tix. So I built one and put it on the PAGE website. If you want to trust me go feel welcome to use it. There installation packages for Tcl that must be installed first.

    Before installing page-2.2.exe on Widows be sure to read Windows Installation. Installing Tix on Windows is facilitated by an install executable which I have made available on the Summary Page. I was unable to find such a Windows install file so I created this one.

    Documentation

    Users Guide

    A fairly comprehensive example including the generated Python code.

    For use with 2.2, I am recommending that one use the default colors and fonts so that a GUI generated by PAGE will look reasonable good in a number of different environments. To go along with this I have included a second example which is really the previous example but restricted to defaults colors and fonts. The screen shot was made in Linux but the GUI looks fine under Windows 98. The size of the second example web page is about 300KB since it contains several screen shots.

    Download

    To download Page, go to the Summary Page from which you can download the most recent version. There is all manner of interesting information there and it is still easy to find the download stuff.

    Other projects to visit

    If you would like to see a project from the lunatic fringe, see SnoPy.

    The Digital Photo Album mentioned below is now a SourceForge project called Fotoalbum. It is a good example of a useful program written with the assistance of PAGE. It is in a better state than mentioned below.

    Some Elisp that makes EMACS a better Python IDE

    I really like emacs and so I have hacked together some things that improve its usage. The most important is a package of extensions to python-mode.el. Also, I have written several function which facilitate the insertion of debugging statements (pyp.el). More recently, I have fussed around with pycomplete and pymacs. Again, see python-mode extensions. All of these extensions are now available in the python-mode-extensions available on the Summary Page.

    Extensions to python-mode.el

    These are some simple extensions to python-mode.el that I recommend. Included are an improved mechanism for executing a python program from an emacs window and a simplified mechanism for getting directly into the python debugger. Functions are there to facilitate navigating the traceback stack in the event of an error. There is also code which allows PyChecker to be run from Emacs.

    Inserting python debugging print statements

    I often need to insert debugging statements into my programs. To facilitate that I wrote several emacs functions. They are pyp for "python print", ppy for "pretty print python", and ppyi for "pretty print python include" ppy is activated by function key 12 (set in my .emacs file) and requests the expression to be printed. A line is then inserted into my code with the proper indentation and looks like

    print "containing_class: containing_function: expression =", expression # user_name pyp

    The trailing user_name and pyp are there to facilitate removing the statements at a later time.

    The macros are in pyp.el. Comments at the beginning of the file show what is necessary to include in your .emacs file.

    pycomplete

    This is a nifty emacs extension which helps one to insert attributes and functions into a python program. For instance, one can type

    os.path.is

    and a window will open up showing all attributes and function in os.path which begin with "is". Also, functions are can be distinguished from simple attributes because they are followed by "()". Pick one with the mouse and hit and the completion will take place. It is required that there be an appropriate include statement, in this case "os.path", in order for the completion to work. If it is not included one get a message the name is undefined.

    I got an early version which was rather limited. Looking around the net, I found reference to an extension patch. When I applied the patch, I saw that it was better. So I removed some unnecessary code from the package and added the facility to distinguish functions and to end up in the python buffer after the completion. There are two pieces to the package - pycomplete.el which is loaded by emacs so must be in the emacs load path and pycomplete.py which should go into an active site-packages directory.

    Pymacs

    Liking both python and emacs, I think that Pymacs is a great idea. I started looking more closely because pycomplete is built on Pymacs. Pymacs is another example of a great piece of code with lousy documentation. Furthermore, the webhome for Pymacs seemed not to exist nor can I find anyone who is maintaining it. Going thru the debian package search I managed to download the source package: pymacs_0.22.orig.tar.gz. There are indications that a .23 version is available but I can't find it. Recently, I found a site devoted to Pymacs; it provides downloads and documentation. This site has documentation labeled Pymacs version 0.23 but the latest packaged version on the site is version 0.22.

    The main problem I found was a paucity of examples. For instance, I fussed around for quite a while before I discovered that the output of print statements show up in the *Pymacs* buffer.

    Small offerings for your consideration.

    Some things I wish that I had found.

    Extensions to Visual Regexp

    Visual Regexp is a very handy program for honing a regular expression. Unfortunately as originally released, it was pretty exasperating as well. Here is a version that I now find much more satisfying.

    Vrex - Visual regexp written in Python

    This is example code based on Visual REGEXP. Vrex provides most of the obvious facilities of that program, hence the lower case in the name.

    Digital Photo Album

    Having recently purchased a digital camera, I needed a program to manage the pictures I took; so I wrote one. It is included album.tar.gz. It is also an instructive example of some of the techniques that I have developed using PAGE. Here I was less concerned about using PAGE to build the program than in using PAGE to build the several top level windows need by the program. The program utilizes 'MySql' to keep attribute information about the pictures, 'exif.py' to parse the exif information from my camera, 'dparse' to parse attribute expressions into sql statements and sets to execute the attribute expressions, and 'PIL' to manipulate the images. I run the program on a Debian Linux system where it links to 'xv' to display the images and 'gimp' to manipulate the images. I have not tried to port the program to MS Windows; in doing that I would have to use a viewer. All in all, it is a good example.

    Refocus plugin for The Gimp.

    I found that the refocus plugin for The Gimp would not build for Gimp version 2.2.6 or 2.2.7. I did a bunch of fussing around and managed to get it working.

    I have been pondering what approach to take to get refocus working. I finally decided that in the interval between the writing refocus and including a preview facility that was missing from Gimp and now,the Gimp folks included such a facility which was slightly different but used some of the same names. In such a scenario if one tried to compile the code, name conflicts would blow one out of the water.

    I decided to try starting with the Gimp 2 version from Stephan Menzel and to bypass the Gimp preview stuff and use the original preview facility in refocus. To do that, I tried compiling refocus and whenever there was a name conflict I would change the name in refocus by appending to the name the string '_ROZEN'. It is not that I am an egotist, it just lets one find all my changes easily and remove them. It only involved three files gimppreview.h, gimppreview.c, and refocus.c.

    The code refocus-0.9.0_gimp2_rozen.tgz can be downloaded and built.

    Adages that have served me well

    From a career of programming I have observed some things that have helped me quite a bit. See adages.

    Author

    I am Don Rozenberg. I encourage you to contact me with any problems, comments or suggestions. I am available for python contract programming. Here is my resume. Keep those cards and letters coming.

    Email:

    "Seeking rationality in a Java-centric world"