Skip to content
Claudio Esperança edited this page Oct 10, 2016 · 6 revisions

This project provides a Python package that creates an environment for graphics applications that closely resembles that of the Processing system. Usage is mostly restricted to importing the package and calling run(). For instance, this simple example taken from a Processing tutorial can be ported to pyprocessing as follows:

// 
// Processing 
//
size(200,200);
rectMode(CENTER);
rect(100,100,20,100);
ellipse(100,70,60,60);
ellipse(81,70,16,32); 
ellipse(119,70,16,32); 
line(90,150,80,160);
line(110,150,120,160);
#
# pyprocessing equivalent
#
from pyprocessing import *
size(200,200)
rectMode(CENTER)
rect(100,100,20,100)
ellipse(100,70,60,60)
ellipse(81,70,16,32) 
ellipse(119,70,16,32) 
line(90,150,80,160)
line(110,150,120,160)
run()

The project mission is to implement Processing's friendly graphics functions and interaction model in Python. Not all of Processing is to be ported, though, since Python itself already provides alternatives for many features of Processing, such as XML parsing.

The pyprocessing backend is built upon OpenGL and Pyglet, which provide the actual graphics rendering. Since these are multiplatform, so is pyprocessing.

We hope that, much in the same spirit of the Processing project, pyprocessing will appeal to people who want to easily program and interact with computer generated imagery. It is also meant to help teaching computer programming by making it possible to write compact code with rich visual semantics.

What are the requirements?

In essence, all you need is the pyglet package (see www.pyglet.org) and its requirements, i.e., OpenGL and Python (2.5 or 2.6). If you are able to run pyglet's sample programs, you are in good shape to run pyprocessing.

Installation

Download the source distribution and put the pyprocessing directory (the one which contains __init__.py, attribs.py, etc) in any place Python expects to find modules and packages. The simplest way of achieving this is to run the provided setup.py program:

python setup.py install

This will copy the files to the proper places. You might have to have administration privileges to do this, however. In most flavors of Linux, for instance, you might have to type:

sudo python setup.py install

Usage

There are several example programs in the examples folder that you may try. You can find in the wiki some quick instructions on how to write a pyprocessing application, a tutorial and a short list of commands and functions.

Clone this wiki locally