Archive for February, 2008

Play – a python squeak clone

Thursday, February 21st, 2008

Play is the current name for a non existent and probably never to exists clone of squeak that currently resides in my mind. I’ve been wanting to have something squeak like but with python syntax, preferably a python engine under it, to play with. I’ve just read the whole thread that included many comments by the patapata guy (too bad he stopped), and resulted apparently from a shuttleworth fund / idea, that is further discussed here. So I’m thinking – how would I name such a program? play is my current idea (acronym however you like, maybe python learning yard), and how would you write it? My current idea is to do nothing at the interpreter level – I’ll start with CPython and exec away. I’ll have to have a gui with event handling, and at a minimum create the halo effect and the Transcript and Component browser (ok, it isn’t named that but I haven’t played enough with squeak to remember unfortunately). I guess I’d create a module and give access to it as a play binding in the namespace I exec user code in. So I’ll have the basic user objects (serializing the image will be done by using the pickle+code I know some guy in python-il did, forgot his name). The gui would be gtk, since I think it’s better then wx which was my previous favorite (gtk seems more stable, especially when combined with twisted). I’ll use twisted’s event loop. Of course I don’t want user code to have to see any of this. I guess all the nice stuff, like EToys, would be implemented by having a bunch of methods in the play module that allow you to tie in to the event system, and of course callbacks are very easy in python. The whole Gui/Event layer will be strictly python, so it will be visible to the user if he wants it too, maybe I’ll find some way to save it too into the image, should be pretty easy (some bootstraping problem here, but shouldn’t be a problem). The actual objects/stuff I’ll have to implement:
event loop – basically just use twisted+gtk for this
windowing system – If I want to implement the halo’s and user objects, to get maximum control I could have a single canvas and implement the whole windowing layer including any painting my self, probably using cairo to do the painting. That would give me maximum flexibility, especially if I decide one of the goals is similarity to squeak look and feel. otoh, if I don’t want to write code to do z-buffering of windows and directing events, I could just use gtk for that and get all the widgets it has (of course I then have more limited portability).
The real question is whether someone already started doing this. I’ll have to read the rest of the thread I guess. How much time could I invest in this? what would I gain by doing so, except scratching an itch which would probably disappear if I left it alone?