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 & HelpProcessing Implementations › python syntax via jython
Pages: 1 2 
python syntax via jython (Read 13241 times)
python syntax via jython
May 22nd, 2008, 5:25pm
hello all

just a short proof of concept for public discussion. what about python for processing?


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:

./jython helloProcessing.py
Re: python syntax via jython
Reply #1 - Jun 2nd, 2008, 5:51pm
If someone could wrap this up into a nice, integrated package that allowed me to package an app for distribution, I would be all over it. My current language of choice is Python with the pyglet library, but I also love the Processing library.
Re: python syntax via jython
Reply #2 - Mar 26th, 2009, 4:21pm
I'm very interested in pythonProcessing as well... Is there a way to have some kind of coding environment like Processing's sketchbook? Or may be use all this in Eclipse?

There is already Field(openendedgroup.com), you can do exactly this, program processing applets with jython, but still will be nice to have very simple processing implimentation for python.

Thank you!
Re: python syntax via jython
Reply #3 - Mar 30th, 2009, 4:26am
What exactly would it take to get Processing to run with Jython? It's something I've been thinking about for a while actually.
Re: python syntax via jython
Reply #4 - Mar 30th, 2009, 8:26am
Would a complete port to Python not be out of the question? Looking at Processing, it doesnt seem so far removed?
Re: python syntax via jython
Reply #5 - Mar 30th, 2009, 8:44am
i think if you were to go for a new IDE you'd want to make sure you can include more implementations not move from one language to another. think processing.js and ruby-processing, think scala and groovy. maybe even mobile and arduino.

Re: python syntax via jython
Reply #6 - Mar 31st, 2009, 5:55am
Running on the top of Jython isnt quite a good idea I feel. Thats an extra layer we dont really need. I think it would be better, in the case of python, to stick with native C and python code. Since there are implementations of OpenGL and various libs to do sound and what not, rewriting processing as a python module wouldnt be so hard
Re: python syntax via jython
Reply #7 - Apr 22nd, 2009, 9:40pm
Sonomute has beaten me to it (above), but if you are interested in Processing & Python (Jython) and you are Mac-based, you could drop by our Field project, here — openendedgroup.com/field. We can always do with some more Processing-oriented beta testing.

Support for "live coding" rather than stop-compile-run is the most obvious feature you get; but there's also early support for other JVM languages (including Scala, JavaScript and embedded Java itself) which seems to be an increasingly important part of Processing's future. And unlike a rewrite in Python, you get to use all of the existing Java-based Processing libraries. And there's also a host of other fringe and interesting features to keep you fringe and interested.
Re: python syntax via jython
Reply #8 - May 19th, 2009, 8:49pm
1. How does this processing.py idea differ from the PRender approach


2. What about Field is Mac-only  Just the text editor part  Python, Processing, Java, etc. are all cross-platform.  Is there a way to get just the functionality that lets us use source code like in this screenshot

Re: python syntax via jython
Reply #9 - May 21st, 2009, 6:19pm
So as I understand it, the PRender idea sets up a renderer in Processing and then passes messages to it from Python.  It seems like just a prototype so far, with static 2D image output.

This method would use Jython to access all the Java stuff, and so theoretically could do anything that Processing can do  Like applets and everything, just with Python syntax  That would be great.

I started to poke around with this today, but immediately got disappointed with Jython because of the things it's missing.  Jython 2.5 should be out very soon, though, maybe days, so I'll wait and try again with that.
Re: python syntax via jython
Reply #10 - May 22nd, 2009, 8:52pm
I got this working in Ubuntu with the Jython from the repositories.  I really don't know what I'm doing, though, so it took me a long time.  Cry  The resulting script is much simpler, though:

jython "$@"


Until Bug 105492 is fixed, you have to set an explicit path to wherever you installed Processing.

The window that pops up is always small, and has to be resized to fit.  Though if I open a window in the normal PDE, and then open one with the jython script, it's the same size.  Need to learn more about how PDE works, I guess.
Re: python syntax via jython
Reply #11 - Oct 8th, 2009, 1:31pm
You might also want to try pyprocessing, an experimental Processing implementation using pyglet. It's at http://code.google.com/p/pyprocessing/
Re: python syntax via jython
Reply #12 - Feb 11th, 2010, 8:59am
I had a bit of a go using the processing base from backspaces dot net, along with the libs from nodebox in jython.


It works OK, and I actually had more trouble with nodebox-web than anything else.
Jython and JOGL in Netbeans?
Reply #13 - Feb 15th, 2010, 6:22pm
Does anybody have an idea of how to opengl on jython on netbeans working reliably?

I set the java library path to my processing JOGL directory
Python Platform->Jython->Main->Command Arguments

But nothing worked unless I added the JOGL directory to the Path, before running netbeans.  
Obviously thats not great, anybody got any ideas how this might work?
Re: python syntax via jython
Reply #14 - Feb 21st, 2010, 5:05pm
I would love it if Processing was in python instead of Java, right now I'm in the process of converting all of my pLAySVG scripts into Processing and it is painful.  It would make Processing much more accessible for educational use.  Unfortunately I don't feel the capacity to be of use in this kind of endeavor... but good luck  Wink
Pages: 1 2