Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 126 lines (94 sloc) 4.707 kB
52ccb15 @google-feinberg markdown README
google-feinberg authored
1 # processing.py #
2
96be640 @jdf removing folder
authored
3 Write [Processing](http://processing.org) sketches in Python.
8abde5e @google-feinberg reformat intro
google-feinberg authored
4 [Jonathan Feinberg](http://mrfeinberg.com) <[jdf@pobox.com](mailto:jdf@pobox.com)>
91f4aa8 @jdf working on regression tests, and the beginnings of a fix for bug #1
authored
5
cd93395 @jdf add plea for eclipse help
authored
6 ## See some [known issues](http://wiki.github.com/jdf/processing.py/) and the [open bugs in the bug tracker](http://github.com/jdf/processing.py/issues). I'm seeking help to create [a simple Eclipse plugin](http://wiki.github.com/jdf/processing.py/eclipse-plugin-spec).
91f4aa8 @jdf working on regression tests, and the beginnings of a fix for bug #1
authored
7
f26f5cb @jdf minor tweaks
authored
8 ## Quick Start ##
3a04d0e @google-feinberg apply benfry suggestions
google-feinberg authored
9
10 $ git clone git://github.com/jdf/processing.py.git
11 $ cd processing.py
12 $ ant
96be640 @jdf removing folder
authored
13
8e21aa9 @jdf reformat readme
authored
14 (or download a distribution from http://github.com/jdf/processing.py/downloads)
96be640 @jdf removing folder
authored
15
631748b @jdf defolderize
authored
16 $ java -jar processing-py.jar examples.py/Basics/Math/noisefield.py
96be640 @jdf removing folder
authored
17 $ java -jar processing-py.jar examples.py/3D/Typography/KineticType.py
4f739fb @jdf destroy more folder. Rewrite SpaceJunk to be more brief
authored
18 $ java -jar processing-py.jar examples.py/Library/OpenGL/SpaceJunk.py
19 $ java -jar processing-py.jar examples.py/3D/Textures/TextureCube.py
d5ea494 @jdf new demo stuff
authored
20 $ cat > mysketch.py
21 def draw():
22 background(0)
23 text(frameRate, 20, 20)
24 $ java -jar processing-py.jar mysketch.py
25
110b743 @jdf show extension use
authored
26 Put processing extension libraries in the "libraries" directory.
d5ea494 @jdf new demo stuff
authored
27
110b743 @jdf show extension use
authored
28 $ curl -O http://mrfeinberg.com/peasycam/download/PeasyCam_0.8.3.zip
29 $ cd libraries
30 $ unzip ../PeasyCam_0.8.3.zip
3a04d0e @google-feinberg apply benfry suggestions
google-feinberg authored
31
110b743 @jdf show extension use
authored
32 Import them in the usual Python way, e.g.
3a04d0e @google-feinberg apply benfry suggestions
google-feinberg authored
33
34 import peasy.PeasyCam
35 cam = peasy.PeasyCam(this, 200)
36
37 or
38
39 import peasy.PeasyCam as PeasyCam
40 cam = PeasyCam(this, 200)
96be640 @jdf removing folder
authored
41
3a04d0e @google-feinberg apply benfry suggestions
google-feinberg authored
42 or
43
44 from peasy import PeasyCam
45 cam = PeasyCam(this, 200)
46
47 Unfortunately, `from foo import *` is not supported.
48
49 Use `this` to refer to the PApplet you're in, as in the examples above.
52ccb15 @google-feinberg markdown README
google-feinberg authored
50
40f12d4 @jdf new examples in readme
authored
51 Put any Python libraries in the "libraries" directory, or in sketch directories.
52 Only pure-Python libraries will work--nothing that requires "native" code.
53
7ba308a @jdf more minor tweaks
authored
54 ## Example Code ##
47be091 @google-feinberg new small example for home page
google-feinberg authored
55
1db383a @jdf new little demo
authored
56 """
57 noisefield.py - demonstrate Perlin noise
58 Jonathan Feinberg
96be640 @jdf removing folder
authored
59 """
1db383a @jdf new little demo
authored
60 srcSize = 50
61 destSize = 400
4e790e7 @jdf wow, OPENGL smoothes stuff beautifully
authored
62 g = createGraphics(srcSize, srcSize, JAVA2D)
1db383a @jdf new little demo
authored
63
64 def setup():
4e790e7 @jdf wow, OPENGL smoothes stuff beautifully
authored
65 size(destSize, destSize, OPENGL)
1db383a @jdf new little demo
authored
66
67 def draw():
68 t = .0005 * millis()
69 g.beginDraw()
70 for y in range(srcSize):
71 for x in range(srcSize):
72 blue = noise(t + .1*x, t + .05*y, .2*t)
73 g.set(x, y, color(0, 0, 255 * blue))
74 g.endDraw()
75 image(g, 0, 0, destSize, destSize)
52ccb15 @google-feinberg markdown README
google-feinberg authored
76
77 ## Why? ##
78
79 I recently gave a talk about Processing to a group of rather bright 8th-graders,
80 as part of a computer-programming summer camp they were attending at my office.
81 Their curriculum up to that point had been in Python, which is an eminently
96be640 @jdf removing folder
authored
82 sensible choice, given the
d61edda @jdf try to guard wikipedia url
authored
83 [pedagogical roots](http://en.wikipedia.org/wiki/ABC_%28programming_language%29)
52ccb15 @google-feinberg markdown README
google-feinberg authored
84 of the language.
85
86 The kids were really turned on by the demos--I showed them the
96be640 @jdf removing folder
authored
87 [white glove](http://whiteglovetracking.com/), and
52ccb15 @google-feinberg markdown README
google-feinberg authored
88 [Golan Levin](http://flong.com/)'s
89 [New Year's cards](http://www.flong.com/storage/experience/newyear/newyear10/)--but
90 they were bogged down by Processing's C-like syntax, which really seems arcane
91 and unnecessarily complex when you're used to Python.
92
93 I shared my experience with Processing creators
94 [Ben Fry](http://benfry.com/) and [Casey Reas](http://reas.com/), and they
95 told me that, indeed, the original Processing was a fork of
3a04d0e @google-feinberg apply benfry suggestions
google-feinberg authored
96 ["Design By Numbers"](http://dbn.media.mit.edu/), with Python and Scheme
52ccb15 @google-feinberg markdown README
google-feinberg authored
97 support hacked in. Support for a multi-lingual programming
98 environment was always part of the plan, so they were enthusiastic
99 about any new attempt at the problem.
100
101 I was able to hack up a proof of concept in a couple of hours, and have
102 managed to create something worth sharing in a couple of weeks. I was only
103 able to do it at all thanks to the brilliant and beautiful
104 [Jython](http://www.jython.org/) project.
105
106 At the time of Processing's first public release, August of 2001,
107 Jython was too young a project to be used in this way. But now, having done
108 absolutely no work to profile and optimize, I can get hundreds of frames
109 per second of 3D graphics on my linux box. So, kudos to the Processing
110 project, and kudos to Jython!
111
7ba308a @jdf more minor tweaks
authored
112 Please play with this,
113 [report bugs](http://github.com/jdf/processing.py/issues),
114 and port more of the Processing examples!
12297b4 @jdf add yourkit ad
authored
115
116 ## A word from a sponsor ##
117
118 YourKit has kindly granted me a license to use their excellent Java profiler.
119 I'm happy to grant them the space to say:
120
121 > YourKit is kindly supporting open source projects with its full-featured Java Profiler.
122 > YourKit, LLC is the creator of innovative and intelligent tools for profiling
123 > Java and .NET applications. Take a look at YourKit's leading software products:
124 > [YourKit Java Profiler](http://www.yourkit.com/java/profiler/index.jsp) and
125 > [YourKit .NET Profiler](http://www.yourkit.com/.net/profiler/index.jsp).
Something went wrong with that request. Please try again.