Thursday, November 13, 2008

i.document » Blog Archive » python processing proof of concept

python processing proof of concept 21.05.2008 by Michael

i am sure that if ben fry and casey reas would start processing today they would use python instead of java. learning the short and efficient python is much easier than the statically typed and lengthy java. no compilation would be necessary anymore, tons of native libraries would be available via c-bindings, etc. nodebox is a nice example of the use of python for computational design. unfortunately it is restricted to os x.

today we are using python for all sorts of automated code generation in wuerzburg. one example is the conversion of fluid simulation data into x3d files for our coperion project. jan and sebastian are using this approach for their simulated cities of their master projects.

i started a short proof of concept of a python based processing. jython is an implementation of python in java. with its help it’s possible to write code with the processing api in python language.

code example (

from processing.core import PApplet

class HelloProcessing(PApplet):

def setup(self):
global p
p = self
p.size(350, 350)

def draw(self):
p.rect(150, 150, 50, 50)

if __name__ == ‘__main__’:
import pawt

1. just download and install jython:

2. put you processing libs into java classpath or modify the startup file (jython) in order to do so:


# This file was generated by the Jython installer
# Created on Mon May 19 20:25:40 CEST 2008 by me

if [ ! -z "$CLASSPATH" ]
“/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java” -Dpython.home=”/Users/me/jython2.2.1″ -classpath “$CP” org.python.util.jython “$@”

3. start the python file in your shell: