Mercurial > cpython-lru_cache-weakref
annotate Doc/lib/libturtle.tex @ 25838:8540887bcec6 2.2
Backport of 2.183:
Fix memory leak in add_subclass() found by NealN with valgrind.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 18 Oct 2002 13:42:21 +0000 |
| parents | a85a3c10ba4d |
| children | 8f70602fbebb |
| 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} |
|
20987
a85a3c10ba4d
Clean up the descriptions of multi-signature functions so we do the right
Fred Drake <fdrake@acm.org>
parents:
15467
diff
changeset
|
76 \funclineni{color}{(r, g, b)} |
|
a85a3c10ba4d
Clean up the descriptions of multi-signature functions so we do the right
Fred Drake <fdrake@acm.org>
parents:
15467
diff
changeset
|
77 \funclineni{color}{r, g, b} |
|
a85a3c10ba4d
Clean up the descriptions of multi-signature functions so we do the right
Fred Drake <fdrake@acm.org>
parents:
15467
diff
changeset
|
78 Set the pen color. In the first form, the color is specified as a |
|
a85a3c10ba4d
Clean up the descriptions of multi-signature functions so we do the right
Fred Drake <fdrake@acm.org>
parents:
15467
diff
changeset
|
79 Tk color specification as a string. The second form specifies the |
|
a85a3c10ba4d
Clean up the descriptions of multi-signature functions so we do the right
Fred Drake <fdrake@acm.org>
parents:
15467
diff
changeset
|
80 color as a tuple of the RGB values, each in the range [0..1]. For the |
|
a85a3c10ba4d
Clean up the descriptions of multi-signature functions so we do the right
Fred Drake <fdrake@acm.org>
parents:
15467
diff
changeset
|
81 third form, the color is specified giving the RGB values as three |
|
a85a3c10ba4d
Clean up the descriptions of multi-signature functions so we do the right
Fred Drake <fdrake@acm.org>
parents:
15467
diff
changeset
|
82 separate parameters (each in the range [0..1]). |
|
11467
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
83 \end{funcdesc} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
84 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
85 \begin{funcdesc}{write}{text\optional{, move}} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
86 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
|
87 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
|
88 \var{move} is false. |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
89 \end{funcdesc} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
90 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
91 \begin{funcdesc}{fill}{flag} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
92 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
|
93 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
|
94 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
|
95 \end{funcdesc} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
96 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
97 \begin{funcdesc}{circle}{radius\optional{, extent}} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
98 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
|
99 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
|
100 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
|
101 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
|
102 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
103 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
|
104 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
|
105 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
|
106 direction. |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
107 \end{funcdesc} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
108 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
109 \begin{funcdesc}{goto}{x, y} |
|
20987
a85a3c10ba4d
Clean up the descriptions of multi-signature functions so we do the right
Fred Drake <fdrake@acm.org>
parents:
15467
diff
changeset
|
110 \funclineni{goto}{(x, y)} |
|
a85a3c10ba4d
Clean up the descriptions of multi-signature functions so we do the right
Fred Drake <fdrake@acm.org>
parents:
15467
diff
changeset
|
111 Go to co-ordinates \var{x}, \var{y}. The co-ordinates may be |
|
a85a3c10ba4d
Clean up the descriptions of multi-signature functions so we do the right
Fred Drake <fdrake@acm.org>
parents:
15467
diff
changeset
|
112 specified either as two separate arguments or as a 2-tuple. |
|
11467
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 |
|
11484
34b6a92fa088
Removed last XXX comment; no further action needed on this one.
Fred Drake <fdrake@acm.org>
parents:
11467
diff
changeset
|
115 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
|
116 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
|
117 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
|
118 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
119 \begin{funcdesc}{demo}{} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
120 Exercise the module a bit. |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
121 \end{funcdesc} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
122 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
123 \begin{excdesc}{Error} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
124 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
|
125 \end{excdesc} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
126 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
127 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
|
128 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
129 This module defines the following classes: |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
130 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
131 \begin{classdesc}{Pen}{} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
132 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
|
133 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
|
134 \end{classdesc} |
|
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}{RawPen}{canvas} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
137 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
|
138 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
|
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 \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
|
142 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
143 \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
|
144 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
|
145 manipulate the given pen. |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
146 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
147 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
|
148 \function{degrees()}. |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
149 |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
150 \begin{methoddesc}{degrees}{\optional{fullcircle}} |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
151 \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
|
152 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
|
153 400 for gradians. |
|
b4d07beac09b
Preliminary documentation for turtle module (Tk), by Moshe Zadka.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
154 \end{methoddesc} |
