[Edu-sig] PySqueak: more on the cultural divide among paradigms

John Zelle john.zelle at wartburg.edu
Sat May 6 17:25:02 CEST 2006


On Friday 05 May 2006 17:54, Dethe Elza wrote:

> Would a VPython implemented on top of PyOpenGL be useful?  Right now
> VPython lives in its own world and doesn't play nice with native
> windows, or PyGame, or OpenGL, or X3D, or OS X, or...  The argument
> for making writing it the way they have it to get the performance
> necessary for physics demos.  Meanwhile, Python has gotten faster,
> machines have gotten *much* faster, and PyOpenGL is getting faster by
> moving to a ctypes-based implementation.
>
> Would a pythonic 3D API, a la VPython, that plays well with others be
> a valuable component for the Squeakification of Python?  Or are we
> talking apples and oranges (pythons and rubies)?
>

I've been thinking about just this sort of project. My hunch is that a Vpython 
in Python is now very doable using PyOpenGL. By building on OpenGL, most of 
the heavy graphics lifting can be done on the graphics card (even cheap ones 
are ridiculously fast these days). The OpenGL API is now standardized and 
stable for development, as long as one sticks to basic features for which 
hardware acceleration can be taken as a given.

But OpenGL is not a modeling API, it's purely for drawing things. We need a 
higher-level standardized scene graph layer (ala VPython). This combination 
would make the entire graphics stack down to hardware Python based. VPython 
as it stands is very nice, but it is not extendable in Python. Want a more 
realistic shading model? No can do. Texture mapping? Out of luck. 
Stereo-modes? (well OK, but I had to do that in C++ ;-).  It might be that 
something like the PyOpenGL Context code base could be used as a starting 
point. 

Along-side the modeling layer we need a good OpenGL-based gui toolkit as well. 
You really can't build a decent GUI in something like VPython.  It would be 
nice if solid, good-looking applications could be built entirely on Python 
w/o having to introduce some other C/C++ dependencies.  Relying only on 
OpenGL would give us a truly portable GUI kit (except for a very thin layer 
that glues it to the underlying windowing system ala GLUT). It could have a 
consistent, though not necessarily native look and feel anywhere OpenGL runs. 
I'm willing to give up native look and feel provided the toolkit looks great 
and has really snappy performance. Another approach would be to make the GUI 
themeable, so folks could easily implement themes to mimick standard native 
widget sets. Basing on OpenGL should provide these abilities. The entire 
X-library has now been impelemented on OpenGL, there's no reason in principle 
a decent OO gui framework couldn't also be built there (and there are already 
some candidates out there to use as models).

<<snip>>
>
> I know I'd love to have a 3D environment that was both easy to use,
> and extensible.

Exactly. I agree that Vpython in Python would be a great start.

<<snip>>

> But Guido has committed that a Squeak-like GUI platform would be
> welcome.  So we are talking about extending the libraries to be more
> encompassing.  I agree about not extending the syntax (any more than
> is already happening for Python 3000).
>

To me, it seems that a 2D/3D persistent scene-graph API  paired with a GUI 
toolkit, both based on PyOpenGL is the obvious first step toward this goal. 
Alone, it would not really be very Squeak-like, but a Squeaky IDE needs the 
ability to describe a persisitent view (2D or 3D) as a basic starting point. 
On top of that foundation others can build the ultimate constructivist 
educational platform...or just some neat, useable 2D and 3D applications. 
Others could work on extending and improving the whole shebang without having 
to know any C or C++.  

The only question in my mind is how do we get started in making this vision a 
reality? I'd love to dive in and start working on it myself, but 
realistically, I've already got a lot of committments (writing is *$&% hard 
work :-). Where do we go from here? Ideas Dethe?

By the way, how is the non-Fink port of Vpython for OSX going? We could really 
use that right now. My Mac students don't want to mess with Fink just to do a 
few Vpython projects.

-- 
John M. Zelle, Ph.D.             Wartburg College
Professor of Computer Science    Waverly, IA     
john.zelle at wartburg.edu          (319) 352-8360  


More information about the Edu-sig mailing list