Thursday, July 27, 2006

Gotta Luv that GUI Goo


GUI programming is an art. You face the user like a punching bag, but instead of hunched over, like an opposing boxer, you're this super-sensitive surface, alert to every mouse motion and key press (up and down strokes separately). That sounds kinda painful, so let's tone it down: you're coding a user-friendly surface, open to unprogrammed sequences of attack (click, click, 'r','r'... etc.).

In wxPython, every wxWidget inherits from an Events-minded superclass, meaning every surface is available for signal processing. There's an implied hierarchy, where unhandled events either die unreported, or trickle up the chain of command, which is automatically searched both ancestrally (an inheritance tree) and in terms of successive containers (what widget's inside of what, out to the top frame and/or application object). The programmer needs to explicitly bind a widget's event handler to whatever types of event (not all events get treated equally).

wxWidgets is actually a C++ library, some 20 years in development, and reaches into each platform (Mac, Windows, Linux) for a native look and feel (unlike Tk, for example, which is equally strange on every OS -- which some people like). wxPython uses SWIG to wrap this library, exposing its functionality in familiar Python syntax. Plus Robin and friends add a few new bells and whistles just for those lucky snake charmers among us (other gnu languages bind to wx as well, including Ruby and Perl).

As we roll around to OSCON 2006 in Portland, gnu math teachers have a new resource to help feed those developing their appetite for facing-the-user "GUI goo", an acquired taste to be sure. The resource? wxPython in Action by Noel Rappin and Robin Dunn (Manning Publications, 2006), ISBN 1-932394-62-1.

wxPython is sponsored in part by the Open Source Applications Foundation.


Follow-up: Monday Inspiration: User Experiences of the Future, Smashing Magazine (November 26, 2007)