We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Python Integration
Page Index Toggle Pages: 1
Python Integration (Read 6955 times)
Python Integration
Mar 23rd, 2006, 1:36am
 
I know this sounds nuts, but after searching the list, I found no-one had mentioned the idea, so here goes!

I'd like to use Python to do graphics work.  Why?  Because most of our projects (http://redfish.com/) use Python in a mix of other tools like NetLogo, Blender, Processing, R, GIS libraries and so on.

(Note: See suggestions to the NetLogo team at http://groups.yahoo.com/group/netlogo-users/message/4381.  Its way cool and shares a great deal with Processing)

One problem Python has is that we can't see the result of our work easily .. we typically interact with Blender and we have yet to get it to render our models quickly.

But then I had a flash: Lets use Processing to render our models in "real time" .. i.e. relatively immediately by building a small Java server that takes in simple protocol requests and uses the Processing libraries to view the results!

Do you know if anyone has tried such a stunt?  I know Jython is out there but its apparently dead and we need some of the more recent Python features.

A server like this would make it possible for the wad of new "agile" languages like Ruby and Python to take advantage of Java/Processing visuals without having to re-invent that wheel.

Owen
Re: Python Integration
Reply #1 - Mar 23rd, 2006, 6:16am
 
I'm not quite sure what you're suggesting. You want to use Python and send the data to Processing for rendering? Why not use Python itself and the multitude of graphics libraries there are for it to render your stuff? I think I'm a bit confused. How does Blender factor into it??
Re: Python Integration
Reply #2 - Mar 24th, 2006, 1:19am
 
> I'm not quite sure what you're suggesting. You want to use Python
> and send the data to Processing for rendering? Why not use Python
> itself and the multitude of graphics libraries there are for it to
> render your stuff? I think I'm a bit confused.
> How does Blender factor into it??

Our group tends to use a "pipeline" approach, several independent programs used in a synergistic way, just like, for example, the Unix shell lets you use several independent programs (sed, grep, awk, etc) in a constructive way.

Recently we've been pursuing more sophisticated graphics.  Our work is in simulation, statistical analysis and visualization.  We generally use NetLogo for initial work, and then use some additional environment for analysis (R, Excel, Octave) and visualization the resulting simulation runs (Quicktime for movie capture, LandSerf for "draping" the 2D images over DEM GIS elevation files, and Blender for adding visuals like fire and flying over the simulation landscape).

In a current wildfire and evacuation simulation, we are using Python for the agent based evacuation model (ABM) running on top of the road GIS shape files for Santa Fe NM.  But the difficulty is that when this is slurped into blender, it does not do fast simple visualization of the ABM.  We can get 1000 cars zipping along at 20 fps in Processing, but .3 or so in blender.  (Note: We use an on-line blender render farm for nice high quality rendering .. but the simple fast rendering just is not the goal of blender.  We're looking into the game engine, but haven't cracked that nut yet.)

None the less, we'd like the Python ABM to be independent, but to be able to see the results visually, without going to the final visualization environment, blender.  We have not really found good Python graphics, but we're not all that hip to Python, so any pointers much appreciated!

So this made us think of Processing.  Jython could be used to let us "drive" Processing from the Python code, but we've found some difficulties with the version differences .. Jython is several major releases back from CPython.

We have used, in the past, nifty stunts with Java where a servlet talks to PHP talks to Flash .. a loose collection of servers.  Worked great!  Fast and wonderful for splitting up the task into environments well suited to their specialty.  This got us thinking about a "Processing Server" .. basically a way for *any* programming language to use Processing, by figuring out a reasonable server protocol for the Processing API.

As I say, this sounds kinda nuts, but boy would it be cool if Python, Ruby, etc could have a nice Processing environment for 2D/3D display.

Does this clarify what we're up to?

Owen
Re: Python Integration
Reply #3 - Mar 24th, 2006, 12:22pm
 
hi owen,
did you already take the osc protocol (http://www.cnmat.berkeley.edu/OpenSoundControl/)into consideration? a lot of apps/environments that are used in sound or on the visual side already implement the protocol (also python and ruby) so the osc protocol could be a possible starting point and foundation.
Re: Python Integration
Reply #4 - Apr 3rd, 2006, 5:21am
 
Owen,
Have you looked at Panda3D (www.panda3d.org) as a replacement for Blender. It's a game engine written in c++ (by disney/cmu) with a set of python bindings. The library is pretty extensive and performance is good. Although, the documentation is incomplete. However, there's a pretty active board.
ira
Re: Python Integration
Reply #5 - Apr 3rd, 2006, 6:12am
 
Not cross platform: No Mac OS X version.  Sigh.

Owen
Re: Python Integration
Reply #6 - Apr 3rd, 2006, 4:51pm
 
Supposedly there's an OS X port being developed. (I'll believe it when I see it Wink)
Re: Python Integration
Reply #7 - May 13th, 2006, 2:49pm
 
have you already tried to use breve [http://www.spiderland.org/breve/] in this context?
Re: Python Integration
Reply #8 - Oct 8th, 2009, 1:19pm
 
You might want to try an experimental Processing implementation in Python called pyprocessing. Take a look at http: //code.google.com/p/pyprocessing/
Page Index Toggle Pages: 1