ONLamp.com    
 Published on ONLamp.com (http://www.onlamp.com/)
 See this if you're having trouble printing code examples


Python News

Hypercard and Python

08/16/2001

12 years ago I took my first look at Hypercard on a friend's new Macintosh II. "So what?" I asked "It's a Rolodex." "Nah," he replied. "This is a Rolodex with brains." Hypercard could contain more than database entries, it could hold mini-applications as well. Mini-applications you could string together as easily as we would later string together web pages and web apps. Hypercard was hypertext and hypermedia and hyper-application. Programming for hyper programmers.

Hypercard's inventor, Bill Atkinson, once called Hypercard a "Software Erector Set." Programming for the Macintosh GUI was much harder than programming for a DOS console. Yet Hypercard made it so simple practically anyone could create their own programs. You didn't have to know much to paint a graphic interface and do a little scripting. Hypercard could even be used to create standalone applications you could distribute. No one needed to know it was Hypercard. The champ of Hypercard applications was Myst, a hypermedia adventure.

Apple has had an on-again-off-again relationship with Hypercard. Initially included for free on Macintosh systems, it later became a commercial product of its own, then was bounced back and forth between Apple and Claris. Steve Jobs finally canned development of Hypercard in 1997. Frozen at version 2.4.1, it's still available through Apple for $99.

Hypercard still lives fondly in the hearts of many programmers. It was their first taste of the art, their first love. In June, Hypercard enthusiest Matt Johnson suggested Apple release Hypercard as Open Source, so development could continue in the hands of those who loved it best. About the same time Johnson's opinion was published, Ron Stephens opined on the comp.lang.python newsgroup for "a PythonCard for event driven gui programs, using the Python syntax and the Hypercard container model." He further lamented his lack of coding ability to make it happen. Less unsure of their coding ability, Neil Hodgson, Roman Suzi, and Kevin Altis among others jumped on the idea. Pythoncard was born.

Pythoncard is currently just a prototype. It doesn't look like Hypercard at all. It's primarily a means of describing the elements of a GUI application in a separate resource file, then describing what those elements do, and how they interact in your Python program. This keeps all the GUI definition stuff out of your Python code, making it much more readable. You give up some control for this, but the resource file used to describe the GUI is fairly rich. It's basically a nested dictionary of GUI elements and parameters that are read into your Python program. Pythoncard handles construction of the GUI based on your description and hooks the elements together with your program.

The Pythoncard prototype uses wxWindows as its GUI toolkit and requires Python 2.1.x and wxPython 2.3.1. It comes in a zipped file. If you install it on a Unix system, you should convert the .py and .txt files that come with it to a Unix format. Python's eval() choked on the extra carriage returns until I converted them using dos2unix. If you're on an MS Windows system it should work fine. There's no documentation, just sample code. The samples, however, are very good. You can take the minimal sample and experiment with modifying its resource files. The proof sample uses many of the GUI elements currently available.

Many open source projects begin as one person shows. Pythoncard is a group effort. Its codebase is still small, and decisions about how to put it together are still being made. If you're one of those programmers with a soft spot for Hypercard, or perhaps are just looking for an open source project to cut your teeth on, consider contributing to this project.

Stephen Figgins administrates Linux servers for Sunflower Broadband, a cable company.


Read more Python News columns.

Return to the Python DevCenter.

Copyright © 2009 O'Reilly Media, Inc.