Thursday, July 13, 2006

basic pygame support

http://mark.dufour.googlepages.com/fysphun.png

this shows an interactive graphical program working with shed skin :-) the user can drag around points, and the connected 'bodies' move around realistically. to get this to work, I had to add basic pygame support (drawing points , lines, event handling). doing this was an interesting experience - I now feel it should be not too difficult to autogenerate bindings to many libraries, based on 1) a simple type model (manually written, see *_.py) and 2) the results of type inference. because my job requires me to implement/bridge some library calls, maybe I can be paid to work on this. hmm..

2 comments:

Unknown said...

Hi Mark,

Since Pygame is not a pure python package,

Do you think it might be possible to support numpy?

Since Shedsking is about performance, one user group that certainly could use some performance, is the number crunchers. however, they are likely to make have use of numpy and Scipy.

That would make these packages an important target for shedskin.

don't you think?

srepmub said...

hiya flavio,

I am not an active user of numpy or scipy, but I am guessing this will be possible in the future, or at least for most functionality.

the most important requirement is that its interface is (mostly) 'statically typed', i.o.w. that it can be translated to C++ at all. but most libraries I have seen (mostly) have this property.

using numpy/scipy is not possible right now however, because shedskin has no binding/translation layer yet, such as boost::python or swig. (to run the pygame program I created a simple ad hoc layer.) there may be some development in this area though :-)

finally, note that a translation layer comes with its own overhead.


thanks!
mark.