annotate Doc/lib/libturtle.tex @ 20737:00a581bdedeb legacy-trunk

When overriding __str__ or __repr__, set the tp_print slot to NULL.
author Guido van Rossum <guido@python.org>
date Mon, 29 Oct 2001 14:33:44 +0000
parents d7864345b1c8
children a85a3c10ba4d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11467
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
1 \section{\module{turtle} ---
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
2 Turtle graphics for Tk}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
3
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
4 \declaremodule{standard}{turtle}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
5 \platform{Tk}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
6 \moduleauthor{Guido van Rossum}{guido@python.org}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
7 \modulesynopsis{An environment for turtle graphics.}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
8
15467
d7864345b1c8 Update Moshe Zadka's email address to one works and might last a while.
Fred Drake <fdrake@acm.org>
parents: 11484
diff changeset
9 \sectionauthor{Moshe Zadka}{moshez@zadka.site.co.il}
11467
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
10
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
11
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
12 The \module{turtle} module provides turtle graphics primitives, in both an
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
13 object-oriented and procedure-oriented ways. Because it uses \module{Tkinter}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
14 for the underlying graphics, it needs a version of python installed with
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
15 Tk support.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
16
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
17 The procedural interface uses a pen and a canvas which are automagically
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
18 created when any of the functions are called.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
19
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
20 The \module{turtle} module defines the following functions:
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
21
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
22 \begin{funcdesc}{degrees}{}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
23 Set angle measurement units to degrees.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
24 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
25
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
26 \begin{funcdesc}{radians}{}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
27 Set angle measurement units to radians.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
28 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
29
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
30 \begin{funcdesc}{reset}{}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
31 Clear the screen, re-center the pen, and set variables to the default
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
32 values.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
33 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
34
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
35 \begin{funcdesc}{clear}{}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
36 Clear the screen.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
37 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
38
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
39 \begin{funcdesc}{tracer}{flag}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
40 Set tracing on/off (according to whether flag is true or not). Tracing
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
41 means line are drawn more slowly, with an animation of an arrow along the
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
42 line.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
43 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
44
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
45 \begin{funcdesc}{forward}{distance}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
46 Go forward \var{distance} steps.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
47 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
48
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
49 \begin{funcdesc}{backward}{distance}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
50 Go backward \var{distance} steps.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
51 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
52
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
53 \begin{funcdesc}{left}{angle}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
54 Turn left \var{angle} units. Units are by default degrees, but can be
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
55 set via the \function{degrees()} and \function{radians()} functions.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
56 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
57
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
58 \begin{funcdesc}{right}{angle}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
59 Turn right \var{angle} units. Units are by default degrees, but can be
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
60 set via the \function{degrees()} and \function{radians()} functions.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
61 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
62
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
63 \begin{funcdesc}{up}{}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
64 Move the pen up --- stop drawing.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
65 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
66
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
67 \begin{funcdesc}{down}{}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
68 Move the pen up --- draw when moving.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
69 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
70
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
71 \begin{funcdesc}{width}{width}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
72 Set the line width to \var{width}.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
73 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
74
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
75 \begin{funcdesc}{color}{s}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
76 Set the color by giving a Tk color string.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
77 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
78
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
79 \begin{funcdesc}{color}{(r, g, b)}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
80 Set the color by giving a RGB tuple, each between 0 and 1.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
81 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
82
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
83 \begin{funcdesc}{color}{r, g, b}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
84 Set the color by giving the RGB components, each between 0 and 1.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
85 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
86
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
87 \begin{funcdesc}{write}{text\optional{, move}}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
88 Write \var{text} at the current pen position. If \var{move} is true,
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
89 the pen is moved to the bottom-right corner of the text. By default,
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
90 \var{move} is false.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
91 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
92
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
93 \begin{funcdesc}{fill}{flag}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
94 The complete specifications are rather complex, but the recommended
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
95 usage is: call \code{fill(1)} before drawing a path you want to fill,
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
96 and call \code{fill(0)} when you finish to draw the path.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
97 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
98
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
99 \begin{funcdesc}{circle}{radius\optional{, extent}}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
100 Draw a circle with radius \var{radius} whose center-point is where the
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
101 pen would be if a \code{forward(\var{radius})} were
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
102 called. \var{extent} determines which part of a circle is drawn: if
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
103 not given it defaults to a full circle.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
104
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
105 If \var{extent} is not a full circle, one endpoint of the arc is the
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
106 current pen position. The arc is drawn in a counter clockwise
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
107 direction if \var{radius} is positive, otherwise in a clockwise
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
108 direction.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
109 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
110
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
111 \begin{funcdesc}{goto}{x, y}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
112 Go to co-ordinates (\var{x}, \var{y}).
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
113 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
114
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
115 \begin{funcdesc}{goto}{(x, y)}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
116 Go to co-ordinates (\var{x}, \var{y}) (specified as a tuple instead of
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
117 individually).
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
118 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
119
11484
34b6a92fa088 Removed last XXX comment; no further action needed on this one.
Fred Drake <fdrake@acm.org>
parents: 11467
diff changeset
120 This module also does \code{from math import *}, so see the
34b6a92fa088 Removed last XXX comment; no further action needed on this one.
Fred Drake <fdrake@acm.org>
parents: 11467
diff changeset
121 documentation for the \refmodule{math} module for additional constants
34b6a92fa088 Removed last XXX comment; no further action needed on this one.
Fred Drake <fdrake@acm.org>
parents: 11467
diff changeset
122 and functions useful for turtle graphics.
11467
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
123
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
124 \begin{funcdesc}{demo}{}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
125 Exercise the module a bit.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
126 \end{funcdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
127
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
128 \begin{excdesc}{Error}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
129 Exception raised on any error caught by this module.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
130 \end{excdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
131
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
132 For examples, see the code of the \function{demo()} function.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
133
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
134 This module defines the following classes:
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
135
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
136 \begin{classdesc}{Pen}{}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
137 Define a pen. All above functions can be called as a methods on the given
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
138 pen. The constructor automatically creates a canvas do be drawn on.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
139 \end{classdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
140
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
141 \begin{classdesc}{RawPen}{canvas}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
142 Define a pen which draws on a canvas \var{canvas}. This is useful if
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
143 you want to use the module to create graphics in a ``real'' program.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
144 \end{classdesc}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
145
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
146 \subsection{Pen and RawPen Objects \label{pen-rawpen-objects}}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
147
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
148 \class{Pen} and \class{RawPen} objects have all the global functions
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
149 described above, except for \function{demo()} as methods, which
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
150 manipulate the given pen.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
151
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
152 The only method which is more powerful as a method is
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
153 \function{degrees()}.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
154
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
155 \begin{methoddesc}{degrees}{\optional{fullcircle}}
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
156 \var{fullcircle} is by default 360. This can cause the pen to have any
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
157 angular units whatever: give \var{fullcircle} 2*$\pi$ for radians, or
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
158 400 for gradians.
b4d07beac09b Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
159 \end{methoddesc}