This is a collection of example sketches demonstrating how Processing.py sketches can import
and use pure-python modules and packages -- whether built-in (like unittest
), simple modules like pyparsing
or complex third-party packages like jinja2
.
Processing.py is Python Mode for Processing. It can be used to quickly wrap Python code together with the Processing Java API and distribute them as cross-platform sketches that run either as standalone apps or within the Processing IDE (PDE). Processing.py supports Python 2.7 running on the Jython 2.7 Python-on-Java interpreter.
Clone or download the collection, or clone or download any sketch in the collection. Then open any .pyde
file using the Processing development envrionment (PDE) application.
If not already installed, you must:
- Download Processing 3.x
- In Processing, install Python Mode:
Processing > Tools > Add Tool > Modes > Python Mode
- Download or clone the sketch repository.
- Launch the example in Processing by double-clicking the
.pyde
file. - Modify the sketch.
Sketches come with the necessary modules (.py) or packages (directories of .py files) already included. To use them in a new sketch, either copy them into a new sketch or install them locally for all sketches.
- In Processing, create and save a new Python Mode sketch.
- In the file browser, open the example sketch
- Copy any modules (.py) or packages (directories of .py files) from the example sketch into the new sketch directory, next to the new
.pyde
file.
The new sketch can now use import mymodule
to access the module.
- In the file browser, open the example sketch
- Copy any modules (.py) or packages (directories of .py files) from the example sketch into the directory Processing > libraries > site-packages
- In Processing, create a new Python Mode sketch.
The new sketch can now use import mymodule
to access the module even without a local copy in its directory.
The blank sketch template offers a new blank Processing.py sketch under version control. Clone / fork / download it -- or use the new_processingpy_sketch.sh
shell script to quickly create a new blank Processing.py sketch under git version control with a unique name. Usage from the command line:
new_processingpy_sketch.sh MySketchFolderName
This will create a new git repo MySketchFolderName
and populate it with a sketch template MySketchFolderName.pyde
.
This project uses semantic versioning. For the versions available, see the tags on this repository.
This project is licensed under the Unlicense - see the LICENSE file for details.