Write Processing sketches in Python
Python Java GLSL Shell C AppleScript Batchfile
Latest commit cd61da0 Oct 16, 2017 @jdf jdf Expose PGraphicsOpenGL's otherwise hidden 'camera' attribute via an a…
…lias, 'cameraMatrix'.
Failed to load latest commit information.
.settings use Java 8 syntax for Python Mode Jul 8, 2017
JREs New ant build process, with JRE auto-download. Jul 6, 2013
buildtime Update to Jython 2.7.1 Sep 24, 2017
examples.py Merge pull request #255 from villares/master Apr 17, 2017
faq Add faq images. Apr 18, 2014
libraries Fix standalone. May 22, 2016
misc Never mind, let's use launch4j. Jul 23, 2014
mode Merge pull request #268 from villares/master Jul 17, 2017
processing-py.app/Contents merge Mar 31, 2016
runtime/src/jycessing Expose PGraphicsOpenGL's otherwise hidden 'camera' attribute via an a… Oct 16, 2017
testing Expose PGraphicsOpenGL's otherwise hidden 'camera' attribute via an a… Oct 16, 2017
workspace Updated example, added redirection support. Mar 31, 2013
.classpath Update to Jython 2.7.1 Sep 24, 2017
.fatjar initial import Jul 19, 2010
.gitignore Get windows stub working Jul 21, 2014
.project Restored Eclipse files. Feb 16, 2013
.pydevproject Use real flags in pde2py Jan 25, 2014
.travis.yml install ant optional tasks, hopefully repairing antlr build Sep 3, 2017
Base - Launch Mode in Eclipse.launch Build 3014. Apr 22, 2016
Base - Sketch Runner First.launch Tell PApplet where the proper sketch home is when running an unsaved,… Jun 20, 2014
HOWTO-HACK.txt Removed brittle JDK language Sep 24, 2017
LICENSE.txt add license Aug 12, 2010
README.markdown ad for yourkit Jan 25, 2017
SketchRunner.launch Fix a couple of memory leaks. Feb 11, 2017
build.xml Merge branch 'master' of github.com:jdf/processing.py Sep 3, 2017
create_build.sh Build 0355. Jun 14, 2014
processing-py-test-suite.launch Simplify end-of-sketch lifecycle handling by overriding exitActual() Apr 1, 2014
processing-py.bat Fixed Windows .bat local Java lookup. Oct 28, 2013
processing-py.sh Allowing running via a symbolic link Oct 21, 2014
testmode.sh How did testmode get screwed up!? Sep 24, 2017


Python Mode for Processing

Write real Processing sketches in Python.

Tested on Mac OS 10.10 and Ubuntu 14.

Build Status

Quick Start

Processing Development Environment

If you're looking to write Processing sketches in Python, your best bet is to use Python Mode. The project is still in its early days, and documentation is lacking, but there are many example sketches to get you started. In general, the Processing reference works just fine for Python mode.

First, download Processing. Then, install Python Mode:

Then try your first sketch:

def setup():
    size(600, 600)

def draw():
    rect(0, 0, width, height)
    fill(frameCount % 255, 255, 255)
    ellipse(mouseX, mouseY, 20, 20)

If you are just getting started, it is a good idea to go through the tutorials on our website, and alternatively some examples.

Using Processing Libraries

Python Mode is implemented in Java, and is designed to be compatible with the existing ecosystem of Processing libraries.

Many libraries need a reference to "the current PApplet", and that's what this is for. Of course, there's no such thing as this in Python; it's just something that processing.py provides for you for compatibility with such libraries.

If you find that some Processing library doesn't work as expected with processing.py, please let us know in the bug tracker.


  • How do I report bugs or request new features?

    Please report any issue in the bug tracker.

  • How can I create a launcher for my sketch?

    Add these lines near the top of your script:

    import launcher
  • How can I use Ani, or any other library that modifies fields?

    Some libraries such as Ani require you to specify a variable name for animation. Unfortunately they cannot access Python variables directly (and Java's built in classes are immutable).

    To solve this problem we instead create a mutable PrimitiveFloat object. This object has a field .value, which you can use for these purposes.

    import jycessing.primitives.PrimitiveFloat as Float
    x = Float(100.0)
    Ani.to(x, 200, "value", 50);  # "value" is the name of the Float's internal field

    In case you need other primitive values, please let us know!

  • Why was this project created?

    I (Jonathan) recently gave a talk about Processing to a group of rather bright 8th-graders, as part of a computer-programming summer camp they were attending at my office. Their curriculum up to that point had been in Python, which is an eminently sensible choice, given the pedagogical roots of the language.

    The kids were really turned on by the demos--I showed them the white glove, and Golan Levin's New Year's cards--but they were bogged down by Processing's C-like syntax, which really seems arcane and unnecessarily complex when you're used to Python.

    I shared my experience with Processing creators Ben Fry and Casey Reas, and they told me that, indeed, the original Processing was a fork of "Design By Numbers", with Python and Scheme support hacked in. Support for a multi-lingual programming environment was always part of the plan, so they were enthusiastic about any new attempt at the problem.

    I was able to hack up a proof of concept in a couple of hours, and have managed to create something worth sharing in a couple of weeks. I was only able to do it at all thanks to the brilliant and beautiful Jython project.

    At the time of Processing's first public release, August of 2001, Jython was too young a project to be used in this way. But now, having done absolutely no work to profile and optimize, I can get hundreds of frames per second of 3D graphics on my linux box. So, kudos to the Processing project, and kudos to Jython!


Written by Jonathan Feinberg <jdf@pobox.com> Launcher & many improvements by Ralf Biedert <rb@xr.io>

Much of the work in achieving compatibility with Processing 3.x was was done by Luca Damasco (Google Summer of Code student), under the supervision of Golan Levin, with additional support from the Frank-Ratchye STUDIO for Creative Inquiry at Carnegie Mellon University. Without Luca, the porject may well have died.

Also, YourKit, LLC was so kind to sponsor a license for their excellent YourKit Java Profiler. Thank you very much! They've asked me to place this message here in return for their sponsorship:

YourKit supports open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.