-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGetting_Started.html
More file actions
79 lines (56 loc) · 6.12 KB
/
Copy pathGetting_Started.html
File metadata and controls
79 lines (56 loc) · 6.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title></title>
</head><body>
<div class="article">
<p>PlotDevice is a Mac OS X application that lets you write Python scripts to produce 2D graphics. It provides a built-in <a href="http://ace.c9.io">editor</a> and allows you to view your script's results <em>as you write it</em>. The graphics that you "draw with code" can be saved as PDFs, images, or even Quicktime/GIF <a href="Animation.html">animations</a>.
</p>
<h2>First Steps</h2>
<p>The first thing you'll want to do once you’ve <a href="http://plotdevice.io/get" class="noexternal">downloaded</a> the application is run some example scripts. There’s a folder with tons of sample code that can be accessed from the app's <span class="message">Examples</span> menu. Select one of them and press <span class="message">⌘R</span> to see it run (if the script is an animation, you can bring it to a halt by pressing <span class="message">⌘.</span>). Then try changing some numbers in the script and run it again to see what happens:
</p>
<div class="media"><img height="526" src="../etc/tut/environment1.png" width="664"/></div>
<p>Next you'll want to have a look at the <a href="../manual.html#ref">reference</a> to see what
scripting <b>commands</b> are available and the sorts of <b>parameters</b> they accept. We'll
learn how to interpret the reference's "syntax definitions" in the chapter on <a href="Primitives.html">drawing primitives</a>. But in the meantime, skimming over the list of commands should give you a general sense of what's possible.</p>
<p>PlotDevice commands let you draw primitive
shapes (<a href="../ref/Primitives.html#poly()">polygons</a>, <a href="../ref/Primitives.html#arc()">circles</a>), create your own shapes (<a href="../ref/Drawing.html#bezier()">Bézier paths</a>), transform the "canvas"
(<a href="../ref/Transform.html#rotate()">rotate</a>, <a href="../ref/Transform.html#scale()">scale</a>, etc.), and work with content generated elsewhere (<a href="../ref/Primitives.html#image()">images</a> & <a href="../ref/Primitives.html#text()">text</a>).
</p>
<h2>Learning the Ropes</h2>
<p>After you've played around with the app for a bit, you should take a look at the other chapters in this Tutorial. They contain essential tips on how the commands work and how to use them in scripts of your own. To really understand what's going on in your PlotDevice scripts, we recommend reading through at least:</p>
<ul>
<li><a href="Environment.html">Environment</a>: using the PlotDevice application to run scripts and export graphics.
</li><li><a href="Primitives.html">Primitives</a>: the fundamental drawing commands and how to call them.
</li><li><a href="Graphics_State.html">Graphics State</a>: how primitives are colored and
transformed.
</li><li><a href="Color.html">Color</a>: the many ways to specify colors.
</li><li><a href="Bezier_Paths.html">Bézier Paths</a>: powerful (but low level) drawing commands.
</li><li><a href="Typography.html">Typography</a>: fonts, text, and typesetting.
</li>
</ul>
<p>Readers who are new to programming may also find the chapters on datatypes and control structures helpful:</p>
<ul>
</li><li><a href="Variables.html">Variables</a>: instead of plugging numbers directly into a
command, you can also store them in a <i>variable</i> and then use the variable throughout
your script.
</li><li><a href="Collections.html">Collections</a>: "lists" & "dictionaries" allow you to organize large amounts of information in a manageable way.
</li><li><a href="Repetition.html">Repetition</a>: "loops" let your code concisely do things more than once.
</li><li><a href="Commands.html">Commands</a>: defining custom "functions" can simplify common tasks.
</li></ul>
<p>Seasoned Pythonistas (and <code>emacs</code> partisans) will want to take a look at:</p>
<ul>
<li><a href="Console.html">Console</a>: running PlotDevice scripts from the command line and using the graphics routines from external Python scripts.</li>
<li><a href="Cocoa.html">Cocoa</a>: taking advantage of native frameworks using the <a href="https://pythonhosted.org/pyobjc/">PyObjC</a> bridge.</li>
</ul>
<h2>PlotDevice is Python</h2>
<p>The programming language that underlies PlotDevice is <a href="http://python.org/">Python</a> (created by Guido van Rossum in the early ’90s). Python emphasizes code readability and programmer productivity; qualities that make it an excellent choice for those just learning to program. These same traits also result in an expressive "sketching" language that makes it easy to experiment in your code without being weighed down by syntactic bookkeeping.</p>
<p>The <a href="https://docs.python.org/3/">official documentation</a> is thorough and highly-readable. If you're just starting out, the <a href="https://docs.python.org/3/tutorial/index.html">Python Tutorial</a> is a well-paced introduction to the language as well as general programming concepts. We like to keep these chapters on the nightstand:</p>
<ul>
<li><a href="https://docs.python.org/3/tutorial/controlflow.html">Control Flow</a>: for-loops, if-statements, and def-statements
</li><li><a href="https://docs.python.org/3/tutorial/datastructures.html#more-on-lists">More on Lists</a>: interesting things you can do with list objects
</li><li><a href="https://docs.python.org/3/library/stdtypes.html#string-methods">String Methods</a>: extremely helpful text-processing utilities
</li><li><a href="https://docs.python.org/3/library/functions.html">Built-ins</a>: functions for basic math, inspecting objects, and more
</li></ul>
<p>Writing your scripts in Python also means being able to take advantage of the thousands of third-party libraries that have been written by the community. Try searching for a topic of interest at the <a href="https://pypi.python.org/pypi?%3Aaction=browse">Python Package Index</a>. We bet you'll be pleasantly surprised by the amount of code you <em>won't</em> have to write.</p>
</div>
</body></html>