Working Python Mode! Sort of.

NOTE: This project is DEPRECATED. Check out's Python Mode instead - it's in Processing's "Add Mode" dropdown menu!

The download:

The repo: python-mode-processing

Unzip into [sketch folder]/mode/PythonMode, so that files have paths like [sketch folder]/mode/PythonMode/ Then, start up processing, and select Python Mode!

Things that work, usually:

  • Writing processing code in python
  • Running processing code with Jython
  • Saving sketches
  • Loading sketches
  • Importing processing libraries & python core libraries

Things that haven't happened yet:

  • Exporting sketches
  • Importing other python libraries
  • Multiple code tabs at once
  • Multiple PDE windows at once
  • Examples
  • Hex color codes
  • Proper syntax highlighting
  • Tests
  • An REPL

In general, the whole thing is buggier than a Volkswagen full of cockroaches and not quite ready for release, but I don't have time to finish it right now, so I figured I'd put it out there and see what people think.

I made this partly because I love processing and python, and think that python's syntax combined with processing's semantics is a recipe for awesome. Java is a great language but python can be clearer and cleaner, especially for small projects and beginning coders.

I also made this because I had spare time and wanted to see what programming a larger project was like. I didn't really have any cohesive plan or follow any best practices, but the code is commented and usually works. The github repo is here and I would love bug reports and contributions, but I don't really have time to fix things right now- if anyone wants to take a crack at it I will gladly hand over the reigns.

A few final notes:

  • set() is now called setPixel(), because set() is a python builtin
  • if you want to write processing sketches in python and have them work consistently, I highly recommend
  • this isn't intended to undermine the other python mode, but I figured that that was more of an experiment than something intended to be actually used. (Also I found it two months into this, so)
  • if you can't run a sketch, try saving it and restarting processing. If that doesn't work, sacrifice a goat to the JVM gods and sprinkle the ashes over a python skeleton.


  • edited November 2013

    Note: I just realized, a month after the fact, that the download link I posted didn't work. It's now updated, and you should be able to actually download the mode now! Whoops. :|

  • Thanks for the update. Everyone on the team really wants a Python mode, but we're all too stretched keeping regular Processing running. Have you thought about maintaining this Mode more seriously?

  • edited November 2013

    A nice bit of work. It seems to be the case that to work in the processing ide, all sketches (irrespective of mode) need to carry the extension *.pde and be wrapped in an eponymous sketch folder. This makes working in the processing ide somewhat less attractive for pythonistas and rubyists, who using their favourite/regular editor suffer no such restrictions. Anyway I've put in the extra effort to modify some of the sketches I developed for see my fork (also I found that the mode builds OK against processing-2.1.0 and jdk1.7.0_45).

  • monkstone: I noticed that- there's a method somewhere that allows you to set the file extensions a mode can work with (and therefore edit other files) but either I've misimplemented it or it doesn't work. Also, the mode currently does some strange contortions to make sketches run as expected, which probably wouldn't transition very well to other editors... I could refactor that into a library that could be imported; actually that is probably very much what I should do. Hm. Also, those examples are excellent, I'd be happy to merge them (although some of them run into lurking bugs in the mode- P3D occasionally spits out errors for no reason, the check if a sketch is static is fairly naive... I can fix those).

    REAS: Yeah, I have. I'm ridiculously busy right now (high school, college applications, etc.) but I should have a little more free time soon. I could take a few weekends and work through the outstanding bugs I'm aware of, get monkstone's examples to work. Could the mode eventually be added to the download menu in vanilla Processing?

  • But how do you export to pdf from pyglet? :(

  • You are confused, this is not pyprocessing, it is nearer

  • I'm sorry, I think I was looking at the wrong thread. I'm going to try this. It looks awesome, thanks, Kazimuth.

    monkstone, I'm also playing with now. I'm checking your blogs. Thanks for your work.

  • It seems that the restriction of only accepting files with *.pde extension was unintended see bug filed by Jonathan Feinberg.

Sign In or Register to comment.