Skip to content
This repository
Newer
Older
100644 163 lines (103 sloc) 7.851 kb
52ccb15d »
2010-08-12 markdown README
1 # processing.py #
2
013cfcba »
2013-09-01 New build!
3 Write real [Processing](http://processing.org/) sketches in Python.
91f4aa81 »
2010-08-15 working on regression tests, and the beginnings of a fix for bug #1
4
5838eaf8 »
2013-09-01 Further work on examples and documentation.
5 * Based on [Processing 2.0](http://processing.org/), and compatible with most [3rd party libraries](http://www.processing.org/reference/libraries/).
9fc890db »
2013-04-01 Updated README.
6 * Source compatible with [Python 2.7.3](http://python.org).
e593710c »
2011-12-15 Remove obsolete known issues reference.
7
66fd78fe »
2013-10-28 Updated list of platforms Processing.py is known to run on.
8 Tested on Mac OS 10.8 & 10.9, Windows XP, 7 & 8, and Ubuntu 12.10.
91f4aa81 »
2010-08-15 working on regression tests, and the beginnings of a fix for bug #1
9
f26f5cb3 »
2010-08-16 minor tweaks
10 ## Quick Start ##
3a04d0e7 »
2010-08-12 apply benfry suggestions
11
013cfcba »
2013-09-01 New build!
12 ### Download Processing.py 0202 ###
351b4935 »
2011-12-15 Update docs.
13
013cfcba »
2013-09-01 New build!
14 - [Mac OS X (83M)](http://py.processing.org/processing.py-0202-macosx.tgz)
15 - [Windows x64 (74M)](http://py.processing.org/processing.py-0202-windows64.zip)
16 - [Windows x32 (72M)](http://py.processing.org/processing.py-0202-windows32.zip)
17 - [Linux x64 (68M)](http://py.processing.org/processing.py-0202-linux64.tgz)
18 - [Linux x32 (69M)](http://py.processing.org/processing.py-0202-linux32.tgz)
351b4935 »
2011-12-15 Update docs.
19
9fc890db »
2013-04-01 Updated README.
20 Then, paste this code into a file, e.g., `mysketch.py`.
6eb14d22 »
2013-03-31 Updated the README.
21
22 def setup():
9fae696e »
2013-06-04 Fix up many broken eamples.
23 size(600, 400)
a7ab1a1d »
2013-07-31 New upload URLs
24
25 def draw():
6eb14d22 »
2013-03-31 Updated the README.
26 ellipse(mouseX, mouseY, 10, 10)
27
013cfcba »
2013-09-01 New build!
28 Drag and drop your sketch onto one of these files, according to your platform:
96be6405 »
2010-09-08 removing folder
29
a7ab1a1d »
2013-07-31 New upload URLs
30 <img src="http://py.processing.org/howtolaunch.jpg"/>
d5ea4942 »
2010-08-14 new demo stuff
31
013cfcba »
2013-09-01 New build!
32 You can also run the sketch from the command line, either with the included launcher script:
9fc890db »
2013-04-01 Updated README.
33
5838eaf8 »
2013-09-01 Further work on examples and documentation.
34 $ ./processing-py.sh path/to/mysketch.py
9fc890db »
2013-04-01 Updated README.
35
5838eaf8 »
2013-09-01 Further work on examples and documentation.
36 or using your own Java runtime environment:
9fc890db »
2013-04-01 Updated README.
37
5838eaf8 »
2013-09-01 Further work on examples and documentation.
38 $ java -jar processing-py.jar path/to/mysketch.py
80a6857c »
2011-12-15 More explicit docs.
39
6eb14d22 »
2013-03-31 Updated the README.
40 ## Documentation ##
80a6857c »
2011-12-15 More explicit docs.
41
9fc890db »
2013-04-01 Updated README.
42 To learn Processing.py check out these resources:
43
44 * Built-in [Processing 2.0 functions](http://processing.org/reference/) for rendering and interaction.
5838eaf8 »
2013-09-01 Further work on examples and documentation.
45 * The [Python 2.7 documentation](http://docs.python.org/2/index.html).
46 * And of course the [Java 7 API documentation](http://docs.oracle.com/javase/7/docs/api/).
9fc890db »
2013-04-01 Updated README.
47
9566792d »
2013-09-01 Oh, Markdown. :(
48 Processing.py comes with many [examples](https://github.com/jdf/processing.py/tree/master/examples.py), most of which are exactly like the
013cfcba »
2013-09-01 New build!
49 example sketches that come with Processing, but converted to Python.
9fc890db »
2013-04-01 Updated README.
50
9566792d »
2013-09-01 Oh, Markdown. :(
51 $ processing-py.sh examples.py/Basics/Math/noisefield.py
52 $ processing-py.sh examples.py/Library/OpenGL/SpaceJunk.py
53 $ processing-py.sh examples.py/3D/Typography/KineticType.py
3a48bf70 »
2013-09-01 Typo.
54 $ processing-py.sh examples.py/3D/Textures/TextureCube.py
9fc890db »
2013-04-01 Updated README.
55
5838eaf8 »
2013-09-01 Further work on examples and documentation.
56 ## Using Processing Libraries ##
9fc890db »
2013-04-01 Updated README.
57
013cfcba »
2013-09-01 New build!
58 Processing.py is implemented in Java, and is designed to be compatible with the existing ecosystem of [Processing libraries](http://processing.org/reference/libraries/).
9fc890db »
2013-04-01 Updated README.
59
013cfcba »
2013-09-01 New build!
60 * Put processing extension libraries in the `libraries` subdirectory of your processing.py installation. Processing.py will search every jar file and directory beneath that special directory, so you don't need to be too fussy about where things go. Just unzip Processing libraries right there.
9fc890db »
2013-04-01 Updated README.
61
013cfcba »
2013-09-01 New build!
62 * Import the library in one of the usual Python ways, as in these snippets:
80a6857c »
2011-12-15 More explicit docs.
63
5838eaf8 »
2013-09-01 Further work on examples and documentation.
64 from peasy import PeasyCam
65 # or
66 import peasy.PeasyCam
67 # or
68 import peasy.PeasyCam as PeasyCam
80a6857c »
2011-12-15 More explicit docs.
69
5838eaf8 »
2013-09-01 Further work on examples and documentation.
70 Unfortunately, `from foo import *` is not supported.
80a6857c »
2011-12-15 More explicit docs.
71
013cfcba »
2013-09-01 New build!
72 * Then, in your `setup()` method:
80a6857c »
2011-12-15 More explicit docs.
73
5838eaf8 »
2013-09-01 Further work on examples and documentation.
74 cam = PeasyCam(this, 200)
d5ea4942 »
2010-08-14 new demo stuff
75
5838eaf8 »
2013-09-01 Further work on examples and documentation.
76 Many libraries need a reference to "the current PApplet", and that's what
013cfcba »
2013-09-01 New build!
77 `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.
3a04d0e7 »
2010-08-12 apply benfry suggestions
78
5838eaf8 »
2013-09-01 Further work on examples and documentation.
79 ## Included Libraries ##
3a04d0e7 »
2010-08-12 apply benfry suggestions
80
5838eaf8 »
2013-09-01 Further work on examples and documentation.
81 Some Processing libraries may not work with processing.py right out of the box. In particular, any library that uses Java reflection to call specially-named functions in your sketch will not work. However, we're happy to modify processing.py to work with any of the official Processing libraries. Here are the libraries that have required special handling in processing.py, and are included in the processing.py download:
3a04d0e7 »
2010-08-12 apply benfry suggestions
82
5838eaf8 »
2013-09-01 Further work on examples and documentation.
83 * [Fisica](http://www.ricardmarxer.com/fisica/), by [Ricard Marxer](http://www.ricardmarxer.com/). Included under the terms of the LGPLv3, and with the kind cooperation of Mr. Marxer. See [examples.py/Fisica](https://github.com/jdf/processing.py/tree/master/examples.py/Fisica) for examples.
a7ab1a1d »
2013-07-31 New upload URLs
84
5838eaf8 »
2013-09-01 Further work on examples and documentation.
85 If you find that some Processing library doesn't work as expected with processing.py, please let us know in the [bug tracker](http://github.com/jdf/processing.py/issues).
3a04d0e7 »
2010-08-12 apply benfry suggestions
86
5838eaf8 »
2013-09-01 Further work on examples and documentation.
87 ## FAQ ##
96be6405 »
2010-09-08 removing folder
88
013cfcba »
2013-09-01 New build!
89 * __How do I report bugs or request new features?__
90
91 Please report any issue in the [bug tracker](http://github.com/jdf/processing.py/issues).
92
93 * __How can I create a launcher for my sketch?__
a7ab1a1d »
2013-07-31 New upload URLs
94
9fc890db »
2013-04-01 Updated README.
95 Add these lines near the top of your script:
96
97 import launcher
98 launcher.create()
99
a7ab1a1d »
2013-07-31 New upload URLs
100 * __How should I load data?__
3a04d0e7 »
2010-08-12 apply benfry suggestions
101
9fc890db »
2013-04-01 Updated README.
102 [Tentative] Along with the launcher, consider using `pwd()` for file paths. For a given argument it resolves the path for an object relative to the currently running script:
80a6857c »
2011-12-15 More explicit docs.
103
9fc890db »
2013-04-01 Updated README.
104 data = load(pwd("data.txt"))
80a6857c »
2011-12-15 More explicit docs.
105
9fc890db »
2013-04-01 Updated README.
106 In that case, processing.py will try to search `data.txt` always where your script resides.
3a04d0e7 »
2010-08-12 apply benfry suggestions
107
9fc890db »
2013-04-01 Updated README.
108 * __How can I use Ani, or any other library that modifies fields?__
a7ab1a1d »
2013-07-31 New upload URLs
109
9fc890db »
2013-04-01 Updated README.
110 Some libraries such as [Ani](http://www.looksgood.de/libraries/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).
a7ab1a1d »
2013-07-31 New upload URLs
111
9fc890db »
2013-04-01 Updated README.
112 To solve this problem we instead create a mutable `PrimitiveFloat` object. This object has a field `.value`, which you can use for these purposes.
52ccb15d »
2010-08-12 markdown README
113
9fc890db »
2013-04-01 Updated README.
114 import jycessing.primitives.PrimitiveFloat as Float
115 x = Float(100.0)
116 Ani.to(x, 200, "value", 50); # "value" is the name of the Float's internal field
117
118 In case you need other primitive values, please [let us know](http://github.com/jdf/processing.py/issues)!
119
120 * __Why was this project created?__
121
013cfcba »
2013-09-01 New build!
122 I ([Jonathan](http://MrFeinberg.com/)) recently gave a talk about Processing to a group of rather bright 8th-graders,
9fc890db »
2013-04-01 Updated README.
123 as part of a computer-programming summer camp they were attending at my office.
124 Their curriculum up to that point had been in Python, which is an eminently
125 sensible choice, given the
126 [pedagogical roots](http://en.wikipedia.org/wiki/ABC_%28programming_language%29)
127 of the language.
128
129 The kids were really turned on by the demos--I showed them the
130 [white glove](http://whiteglovetracking.com/), and
131 [Golan Levin](http://flong.com/)'s
132 [New Year's cards](http://www.flong.com/storage/experience/newyear/newyear10/)--but
133 they were bogged down by Processing's C-like syntax, which really seems arcane
134 and unnecessarily complex when you're used to Python.
135
136 I shared my experience with Processing creators
137 [Ben Fry](http://benfry.com/) and [Casey Reas](http://reas.com/), and they
138 told me that, indeed, the original Processing was a fork of
139 ["Design By Numbers"](http://dbn.media.mit.edu/), with Python and Scheme
140 support hacked in. Support for a multi-lingual programming
141 environment was always part of the plan, so they were enthusiastic
142 about any new attempt at the problem.
143
144 I was able to hack up a proof of concept in a couple of hours, and have
145 managed to create something worth sharing in a couple of weeks. I was only
146 able to do it at all thanks to the brilliant and beautiful
147 [Jython](http://www.jython.org/) project.
148
149 At the time of Processing's first public release, August of 2001,
150 Jython was too young a project to be used in this way. But now, having done
151 absolutely no work to profile and optimize, I can get hundreds of frames
152 per second of 3D graphics on my linux box. So, kudos to the Processing
153 project, and kudos to Jython!
6eb14d22 »
2013-03-31 Updated the README.
154
155
156 ## Credits ##
157
a7ab1a1d »
2013-07-31 New upload URLs
158 Written by [Jonathan Feinberg](http://mrfeinberg.com) &lt;[jdf@pobox.com](mailto:jdf@pobox.com)&gt;
159 Launcher & many improvements by [Ralf Biedert](http://xr.io) &lt;[rb@xr.io](mailto:rb@xr.io)&gt;
6eb14d22 »
2013-03-31 Updated the README.
160
9fc890db »
2013-04-01 Updated README.
161 Also, [YourKit, LLC](http://www.yourkit.com) was so kind to sponsor a license for their excellent [YourKit Java Profiler](http://www.yourkit.com/java/profiler/index.jsp). Thank you very much!
47be0918 »
2010-08-12 new small example for home page
162
Something went wrong with that request. Please try again.