[Edu-sig] Version 0.2.03 of PataPata released (adds Jython/Swing support)

Paul D. Fernhout pdfernhout at kurtz-fernhout.com
Mon Aug 7 22:58:17 CEST 2006


Version 0.2.03 of PataPata (a live Python object environment of Prototypes 
and Morphs) has been released. The zip file is at:
   http://sourceforge.net/project/showfiles.php?group_id=165910

The big thing in this new version is support for Jython (2.2 only) using 
the Swing interfaces ans supporting essentially the same prototype-based 
API and widget dragging GUI as the TK version uses. The Inspector and 
Dandelion example world also work under Swing in this release (and needed 
only minor changes from the TK version).

Read on for more details.

== testing wanted

Any "Smoke Test" level (e.g. does it run at all for you?) feedback on 
trying PataPata under Jython 2.2 on various Mac/Win/GNULinux 
configurations would be appreciated. You need to use a Jython 2.2 (not 
2.1) version (sorry, PataPata save file source format uses "object" for 
metaclass support for loading files). Jython 2.2 can be downloaded and 
installed from links here:
    http://www.jython.org/Project/installation.html
To run PataPata for Jython under GNU/Linux (assuming 
jythonRelease_2_2alpha1 is installed in your home directory), use:
   java -jar ~/jythonRelease_2_2alpha1/jython.jar PataPata.py

I'm getting this out early so people can play with it. As the first Swing 
verison it is bound to have some issues. Still lots of rough edges and 
some cut corners (e.g. some missing events like enter/leave). A future 
version needs to integrate the swing and TK versions better so that user 
World files that are now "almost" the same will really be the same.

== unique benefits to a Jython version

It might be possible to add quicker prototype method dispatch lookup more 
easily to a Jython version as a patch on top of regular Jython as opposed 
to doing that under C.

I'm not sure I'm up for it at the moment, but in theory with a little big 
of effort and wading through Sun's documentation (and ignoring some other 
potential deployment issues, e.g.
   "why we dropped Java web start"
   http://www.dynamicobjects.com/d2r/archives/002859.html )
one could in theory make a one click Web Start application with PataPata 
and Jython that would give you a live Python environment with a GUI 
builder and Inspector with (essentially) one click from a browser on any 
computer with Java Web Start enabled. That might be nice in some 
educational settings. No doubt WebStart will continue to improve as a 
delivery vehicle, just like I hope Sun's Java will be "open source" someday.

== grungy work to be done

Right now there is a lot of duplication of files between Swing and TK 
(havign similar WorldInspectorTK.py and WorldInspectorSwing.py files, 
etc.) Ideally, I want to refactor the system to have common files, general 
platform files, and unique platform files
   such as: WorldInspector.py, WorldDandelionGarden.py, 
WorldConversions.py, WorldExample.py, WorldEmpty.py
   	using WorldCommon.py, which woudl import UtilitiesCommon.py,
   	which would import one of: CrossPlatformWrappingOfTK.py, 
CrossPlatformWrappingOfSwing.py, CrossPlatformWrappingOfGTK.py, 
CrossPlatformWrappingOfWX.py
   	World files could then also import: WorldOnlyForTK.py, 
WorldOnlyForSwing.py, WorldOnlyForGTK.py, WorldOnlyForWX.py making them 
platform dependent. Doable, but that looks like some slogging. :-(

== future directions and a pause for reflection

Perhaps the best news about this all shows that I can make progress using 
PataPata and any specific widget set it wraps and then later use the 
(almost) identical code on another platform with some effort to write 
support code for that platform. Of course, Python's anygui and even 
wxPython has already done that, but in a different way. :-) Still, I know 
that the more I stray from the basic widgets (Buttons, Labels, Lists) the 
more work that would be -- but it is likely fairly doable. On the other 
hand, a truly 3D GUI if I had one is not going to be easily portable to a 
2D platform. This version also started a GLUT 3D version of the interface, 
but that just opens a window as a proof of concept (I like the 3D 
approach, but it looks like a lot of work).

Anyway, the good news is, PataPata now supports the default GUI for the 
Python and Jython releases. That means people could write some simple 
educational software that run on both platforms using (near) identical 
code. I don't think I'll venture into IronPython dot net support any time 
soon to cover all the major Python bases (I've never used IronPython and 
don't want to learn it right now).

I'm not sure where to go from here on GUIs as I've gotten more interested 
in the "One Laptop per Child" project
   http://laptop.org/
and they are using Python and GTK.
   http://wiki.laptop.org/go/GTK
 From there: "GTK+ is the basic GUI toolkit used by Sugar and other OLPC 
applications. Any application that needs a GUI consisting of standard 
Windows, Icons, Menus and Pointers should use GTK+. The OLPC include the 
PyGTK Module to simplify the task of building Python applications. "
Clearly WX or Swing or TK or GLUT have more general interest. Still, I'm 
tempted to move in a GTK direction for the reasons both of the OLPC 
project and also because GTK might be a nice solution for previous reasons 
mentioned on the edusig list (though at a cost of initial install issues 
on Mac and Windows).

On the other hand, after doing even more coding in Python, I'm really 
missing even more all the Smalltalk development tools, a situation which 
PataPata hopes to improve a little, of course, at some continued effort 
which looks somewhat boring/daunting at this point. :-) Venting a little, 
there is also not much one can do about the fact that the Smalltalk syntax 
and message passing approach (to me) is clearer for prototype based 
systems than Python's parenthetical functional notation. This is because 
in Smalltalk or Self, "self x" to get and "self x:" to set are clearly 
messages and not possibly variable accesses, unlike Python's "self.x", 
"self.x = value", "self.x()", "self.x(value)" permutations adding 
possibility for confusion (i.e. should self.x to get a property value be 
used with equals or as a function call?).

Still, when I contemplate other systems for a PataPata base which meet my 
licensing interests and have an underlying simplicity, like GNU Smalltalk
    http://www.gnu.org/software/smalltalk/
or the io language
    http://www.iolanguage.com/about/
or Parrot
   http://www.parrotcode.org/
or Prometheus on bigloo, PLT, or another Scheme:
   http://www.forcix.cx/software/prometheus/prometheus.html
   http://www-sop.inria.fr/mimosa/fp/Bigloo/
   http://www.plt-scheme.org/
or others, I have to admit Python is more ubiquitous and so makes for an 
easier and more reliable PataPata install with a bigger community. Python 
has never let me down for a variety opf projects and refining those Python 
skills have also had commercial value (for me).

I have written most of a Smalltalk grammar for ANTLR (some bugs), and 
there is already Bistro Smalltalk for Java, so that is another possible 
direction too (perhaps using some Jython technology). And, even Squeak is 
now in a position to fight its way back starting again from 1.1 with a new 
"open source" license too, so we will see how that goes (though, as Alan 
Kay, said almost ten years back, Squeak was just hopefully a stepping 
stone to something better).

I'm still left wanting simple prototypes with a Self-like syntax on a 
modern well supported cross-platform runtime (but not Self itself, as I 
find that too complex in apporach :-). Continuing PataPata with Python can 
still realize something good but at a cost of (IMHO) a weaker and more 
complex syntax, some extra complexity, and a bit of a performance hit (but 
potentially more interest to users). Of course, if nobody really sees the 
value in it, then focusing with something more Smalltalk syntax (even on 
top of Python) may make more sense for me personally. Still, PataPata 
0.2.02 is up to 47 downloads from SourceForge, so there is some interest 
there.

Alex J. Champandard wrote to me (after seeing the ShowMeDo video by 
Francois) about a similar project he started a couple months ago (great 
minds think alike!) which focuses more on 3D issues, available here:
   http://alive.sourceforge.net/
so integrating PataPata somehow with his work is another possibility.

So anyway, since my trip, I've been moving into a period of further 
reflection on what my goals are at this point, but I still wanted to get 
this Jython/Swing version finished enough to release in any case. 
Basically I'm one person working on this with very limited time, and I 
think I have successfully proved the concept that you can have Morphs and 
Prototypes under Python and in a somewhat Pythonic-way (if there was 
indeed any doubt). Now I have to think about where to go next, whether to 
continue on the pink plane Python/Squeak merger roadmap I outlined on 
edusig a while back, (*)
   http://mail.python.org/pipermail/edu-sig/2006-April/006226.html
or whether to move into the blue plane (again) (**)
with other approaches to software environments for learning.

The biggest thing driving me right now is having several educational 
applications I want to port from Delphi, so I'll make some sort of 
decision one way or another, even if just deciding plain Jython or Python 
without prototypes is easier. :-)

--Paul Fernhout
(*) Separately I've also considered some of the network debugging issues 
I've outlined there as well, but decided to hold off on them as a priority 
for security issues, but that could also be a big next step for PataPata.
(**) Definition of Alan Kay's pink and blue planes and comments on 
tensions from them for developers (an interesting read for anyone on a 
development oriented mailing list.  :-):
http://lists.squeakfoundation.org/pipermail/squeak-dev/2003-February/052648.html


More information about the Edu-sig mailing list