Thursday, August 06, 2009

wxErlang in Action -- Listing 1.1

So, to teach myself wxWidgets in the context of Erlang, what else to do than start with the book I already have to hand (wxPython in Action), and work through the examples one by one...

This is the equivalent of the Listing 1-1 showing a not quite trivial wxPython example in 20 lines. Erlang makes 25 lines, mainly due to having to explicitly wire up the frame close event:

which demonstrates hooking up the frame's inherent exit button (in windows, the kiss of death at the upper right); and a mouse-move event handler, from which we extract the coordinate information.

It's all quite simple once you've figured out how one might convert from the simple examples in Erlang Programming and the rather less than pellucid wxErlang documentation.

Post a Comment