Visual programming, looking for graphics layer

Terry Hancock hancock at anansispaceworks.com
Thu Nov 14 05:09:47 EST 2002


Hi Ian,
On Wednesday 13 November 2002 11:31 pm,  Ian Bicking wrote:
> After implementing a little Logo interpreter, I wanted to do
> something more novel and interesting, like
> Boxer.  In the extremely likely case you don't know anything about
> Boxer, the website is at:
> 
>   http://www.soe.berkeley.edu/boxer/
> 
> It's a neat teaching language, where it has some graphical ways to
> present programming structure.  Sadly its only available for Macs, and I
> don't know if development is active.  But I've put up a little graphic
> taken from one of the papers (and fixed up a bit) to give a feel:
> 
>   http://colorstudy.com/tmp/boxer-capture.gif

I've always been interested by visual metaphors for programming (I've never 
found one of actual practical use to me, but I keep hoping to -- there's a 
couple, like "overflow" that I want to spend some time to learn).  Anyway,
that's fairly interesting  (not really enough information on the web pages to 
form a real opinion, though -- might have to dig deeper).

> The hard part is that this sort of layout is fairly hard to do.  Not
> only do you have text inside different sorts of boxes, but an important
> part of the language is that you also have non-text literals (like
> colors and shapes, and even lists may be represented in a graphical
> fashion).  All these need to be manipulatable.

Most of these things seem like fairly common GUI widgets to me -- the sticky 
part is probably editing them interactively.

> I'm hoping to get some advice or pointers on something already available
> that can make this easier.  I could use pygame, maybe even with pyui,
> but that's still a long way from what I'd have to do for even the most
> minimal functionality.  I've also had a hard time understanding pyui's
> architecture -- there's something magic in there and I can't tell where
> things actually get *done*... but I'm sure that's surmountable.  Maybe
> that's where I should be looking.

I've been tinkering with PyUI (trying to implement the AWT renderer so it can 
be used in Jython -- following up the browser applets thread I started a few 
days ago).  Clearly, I'm not an expert yet, but I plan to spend a lot of time 
with it -- maybe we can figure it out together?

Briefly, it appears to me that a PyUI renderer starts up and calls a program 
to run under PyUI using that renderer. The program creates widgets to respond 
to various events. At that point, the program idles, waiting for events 
posted from the renderer to PyUI's events mechanism which drives the 
modification of the GUI model inside of PyUI. The model is rendered to the 
display by the renderer. Interestingly, it doesn't really appear to matter 
whether the renderer polls for events or catches events (as in interrupts).  
The renderer is pretty simple, and just has to handle drawing and catching 
the events. So far the most complicated thing seems to be fonts.

I'm not sure what exactly you meant by "things" and "done", but I hope that 
summary is helpful in some way.

The one thing I find frustrating with PyUI (as it is now), is that many of 
the primitive data structures "rect", "pos", "font" aren't really very well 
defined.  I'm not sure if this is a problem for the application programmer, 
though.

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list