Clone this wiki locally
Does this mean I can use SciPy!? NumPy!?
No. Processing's Python Mode is implemented in Java, and relies on the Jython project's implementation of the Python programming language. You can use any "pure Python" module, meaning any Python module that has no "native code" component. Just copy the module (individual
.py files or a directory tree of
.py files) into your sketch directory, and
import it as usual.
The Python standard library is included.
Can I use all of the existing third-party libraries for Processing?
Yes, or at least almost all of them. Python Mode introduces the
add_library('library_name') function, which puts the named library on your sketch's class path, and imports its class names into your sketch. For example, to use the PeasyCam camera-control library:
add_library('peasycam') def setup(): size(600, 600, P3D) PeasyCam(this, 100) def draw(): background(0) rotateX(.5) rotateY(.2) fill(255, 100, 100) box(30) pushMatrix() translate(20, 0, 0) fill(100, 255, 100) box(8) popMatrix()
Some libraries--those that depend on certain functions being defined in your sketch--will not work. As we become aware of those, we will try to work with the authors of those libraries to make the design compatible with Python Mode, or at least to provide workarounds.
What version of Python is supported?
Python Mode is source-compatible with Python 2.7.3.
Where are the examples and documentation?
We intend to have an extensive example portfolio finished in time for the academic year beginning in the fall of 2014. There are already a few examples from the standard Processing mode ported to Python, and more will appear over time.
We intend, also, to port the reference documentation into Python syntax. However, in the meantime, you may refer to the standard Processing documentation, and remove the semicolons!
How do I use Python Mode for Processing?
First, install version 2.1.2 or better of the Processing Development Environment. Then, install the mode as pictured below: