Mercurial > cpython-lru_cache-weakref
annotate Doc/library/turtle.rst @ 54294:dba767bc3155 legacy-trunk
remove mention of old ctypes version
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 23 May 2009 20:59:09 +0000 |
| parents | abc80f8b0dfd |
| children | 3fe2d1d37cf1 |
| rev | line source |
|---|---|
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
1 ======================================== |
|
47183
b53604fad54b
Tkinter rename reversal: remove tkinter package, adapt imports and docs.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
2 :mod:`turtle` --- Turtle graphics for Tk |
|
b53604fad54b
Tkinter rename reversal: remove tkinter package, adapt imports and docs.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
3 ======================================== |
|
b53604fad54b
Tkinter rename reversal: remove tkinter package, adapt imports and docs.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
4 |
|
47947
e5e12d31057e
Add turtle into the module index.
Martin v. Löwis <martin@v.loewis.de>
parents:
47937
diff
changeset
|
5 .. module:: turtle |
|
e5e12d31057e
Add turtle into the module index.
Martin v. Löwis <martin@v.loewis.de>
parents:
47937
diff
changeset
|
6 :synopsis: Turtle graphics for Tk |
|
e5e12d31057e
Add turtle into the module index.
Martin v. Löwis <martin@v.loewis.de>
parents:
47937
diff
changeset
|
7 .. sectionauthor:: Gregor Lingl <gregor.lingl@aon.at> |
|
e5e12d31057e
Add turtle into the module index.
Martin v. Löwis <martin@v.loewis.de>
parents:
47937
diff
changeset
|
8 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
9 .. testsetup:: default |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
10 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
11 from turtle import * |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
12 turtle = Turtle() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
13 |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
14 Introduction |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
15 ============ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
16 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
17 Turtle graphics is a popular way for introducing programming to kids. It was |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
18 part of the original Logo programming language developed by Wally Feurzig and |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
19 Seymour Papert in 1966. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
20 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
21 Imagine a robotic turtle starting at (0, 0) in the x-y plane. Give it the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
22 command ``turtle.forward(15)``, and it moves (on-screen!) 15 pixels in the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
23 direction it is facing, drawing a line as it moves. Give it the command |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
24 ``turtle.left(25)``, and it rotates in-place 25 degrees clockwise. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
25 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
26 By combining together these and similar commands, intricate shapes and pictures |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
27 can easily be drawn. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
28 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
29 The :mod:`turtle` module is an extended reimplementation of the same-named |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
30 module from the Python standard distribution up to version Python 2.5. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
31 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
32 It tries to keep the merits of the old turtle module and to be (nearly) 100% |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
33 compatible with it. This means in the first place to enable the learning |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
34 programmer to use all the commands, classes and methods interactively when using |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
35 the module from within IDLE run with the ``-n`` switch. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
36 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
37 The turtle module provides turtle graphics primitives, in both object-oriented |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
38 and procedure-oriented ways. Because it uses :mod:`Tkinter` for the underlying |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
39 graphics, it needs a version of python installed with Tk support. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
40 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
41 The object-oriented interface uses essentially two+two classes: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
42 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
43 1. The :class:`TurtleScreen` class defines graphics windows as a playground for |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
44 the drawing turtles. Its constructor needs a :class:`Tkinter.Canvas` or a |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
45 :class:`ScrolledCanvas` as argument. It should be used when :mod:`turtle` is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
46 used as part of some application. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
47 |
|
49344
d88f1f2f0213
Issue #3965: Allow repeated calls to turtle.Screen, by making it a
Martin v. Löwis <martin@v.loewis.de>
parents:
47947
diff
changeset
|
48 The function :func:`Screen` returns a singleton object of a |
|
d88f1f2f0213
Issue #3965: Allow repeated calls to turtle.Screen, by making it a
Martin v. Löwis <martin@v.loewis.de>
parents:
47947
diff
changeset
|
49 :class:`TurtleScreen` subclass. This function should be used when |
|
d88f1f2f0213
Issue #3965: Allow repeated calls to turtle.Screen, by making it a
Martin v. Löwis <martin@v.loewis.de>
parents:
47947
diff
changeset
|
50 :mod:`turtle` is used as a standalone tool for doing graphics. |
|
d88f1f2f0213
Issue #3965: Allow repeated calls to turtle.Screen, by making it a
Martin v. Löwis <martin@v.loewis.de>
parents:
47947
diff
changeset
|
51 As a singleton object, inheriting from its class is not possible. |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
52 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
53 All methods of TurtleScreen/Screen also exist as functions, i.e. as part of |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
54 the procedure-oriented interface. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
55 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
56 2. :class:`RawTurtle` (alias: :class:`RawPen`) defines Turtle objects which draw |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
57 on a :class:`TurtleScreen`. Its constructor needs a Canvas, ScrolledCanvas |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
58 or TurtleScreen as argument, so the RawTurtle objects know where to draw. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
59 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
60 Derived from RawTurtle is the subclass :class:`Turtle` (alias: :class:`Pen`), |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
61 which draws on "the" :class:`Screen` - instance which is automatically |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
62 created, if not already present. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
63 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
64 All methods of RawTurtle/Turtle also exist as functions, i.e. part of the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
65 procedure-oriented interface. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
66 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
67 The procedural interface provides functions which are derived from the methods |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
68 of the classes :class:`Screen` and :class:`Turtle`. They have the same names as |
| 52143 | 69 the corresponding methods. A screen object is automatically created whenever a |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
70 function derived from a Screen method is called. An (unnamed) turtle object is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
71 automatically created whenever any of the functions derived from a Turtle method |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
72 is called. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
73 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
74 To use multiple turtles an a screen one has to use the object-oriented interface. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
75 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
76 .. note:: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
77 In the following documentation the argument list for functions is given. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
78 Methods, of course, have the additional first argument *self* which is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
79 omitted here. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
80 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
81 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
82 Overview over available Turtle and Screen methods |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
83 ================================================= |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
84 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
85 Turtle methods |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
86 -------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
87 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
88 Turtle motion |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
89 Move and draw |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
90 | :func:`forward` | :func:`fd` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
91 | :func:`backward` | :func:`bk` | :func:`back` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
92 | :func:`right` | :func:`rt` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
93 | :func:`left` | :func:`lt` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
94 | :func:`goto` | :func:`setpos` | :func:`setposition` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
95 | :func:`setx` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
96 | :func:`sety` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
97 | :func:`setheading` | :func:`seth` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
98 | :func:`home` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
99 | :func:`circle` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
100 | :func:`dot` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
101 | :func:`stamp` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
102 | :func:`clearstamp` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
103 | :func:`clearstamps` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
104 | :func:`undo` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
105 | :func:`speed` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
106 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
107 Tell Turtle's state |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
108 | :func:`position` | :func:`pos` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
109 | :func:`towards` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
110 | :func:`xcor` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
111 | :func:`ycor` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
112 | :func:`heading` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
113 | :func:`distance` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
114 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
115 Setting and measurement |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
116 | :func:`degrees` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
117 | :func:`radians` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
118 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
119 Pen control |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
120 Drawing state |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
121 | :func:`pendown` | :func:`pd` | :func:`down` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
122 | :func:`penup` | :func:`pu` | :func:`up` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
123 | :func:`pensize` | :func:`width` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
124 | :func:`pen` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
125 | :func:`isdown` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
126 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
127 Color control |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
128 | :func:`color` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
129 | :func:`pencolor` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
130 | :func:`fillcolor` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
131 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
132 Filling |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
133 | :func:`fill` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
134 | :func:`begin_fill` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
135 | :func:`end_fill` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
136 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
137 More drawing control |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
138 | :func:`reset` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
139 | :func:`clear` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
140 | :func:`write` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
141 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
142 Turtle state |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
143 Visibility |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
144 | :func:`showturtle` | :func:`st` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
145 | :func:`hideturtle` | :func:`ht` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
146 | :func:`isvisible` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
147 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
148 Appearance |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
149 | :func:`shape` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
150 | :func:`resizemode` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
151 | :func:`shapesize` | :func:`turtlesize` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
152 | :func:`settiltangle` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
153 | :func:`tiltangle` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
154 | :func:`tilt` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
155 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
156 Using events |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
157 | :func:`onclick` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
158 | :func:`onrelease` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
159 | :func:`ondrag` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
160 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
161 Special Turtle methods |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
162 | :func:`begin_poly` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
163 | :func:`end_poly` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
164 | :func:`get_poly` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
165 | :func:`clone` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
166 | :func:`getturtle` | :func:`getpen` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
167 | :func:`getscreen` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
168 | :func:`setundobuffer` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
169 | :func:`undobufferentries` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
170 | :func:`tracer` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
171 | :func:`window_width` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
172 | :func:`window_height` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
173 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
174 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
175 Methods of TurtleScreen/Screen |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
176 ------------------------------ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
177 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
178 Window control |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
179 | :func:`bgcolor` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
180 | :func:`bgpic` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
181 | :func:`clear` | :func:`clearscreen` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
182 | :func:`reset` | :func:`resetscreen` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
183 | :func:`screensize` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
184 | :func:`setworldcoordinates` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
185 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
186 Animation control |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
187 | :func:`delay` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
188 | :func:`tracer` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
189 | :func:`update` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
190 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
191 Using screen events |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
192 | :func:`listen` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
193 | :func:`onkey` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
194 | :func:`onclick` | :func:`onscreenclick` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
195 | :func:`ontimer` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
196 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
197 Settings and special methods |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
198 | :func:`mode` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
199 | :func:`colormode` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
200 | :func:`getcanvas` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
201 | :func:`getshapes` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
202 | :func:`register_shape` | :func:`addshape` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
203 | :func:`turtles` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
204 | :func:`window_height` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
205 | :func:`window_width` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
206 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
207 Methods specific to Screen |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
208 | :func:`bye` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
209 | :func:`exitonclick` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
210 | :func:`setup` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
211 | :func:`title` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
212 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
213 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
214 Methods of RawTurtle/Turtle and corresponding functions |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
215 ======================================================= |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
216 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
217 Most of the examples in this section refer to a Turtle instance called |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
218 ``turtle``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
219 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
220 Turtle motion |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
221 ------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
222 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
223 .. function:: forward(distance) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
224 fd(distance) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
225 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
226 :param distance: a number (integer or float) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
227 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
228 Move the turtle forward by the specified *distance*, in the direction the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
229 turtle is headed. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
230 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
231 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
232 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
233 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
234 (0.00,0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
235 >>> turtle.forward(25) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
236 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
237 (25.00,0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
238 >>> turtle.forward(-75) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
239 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
240 (-50.00,0.00) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
241 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
242 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
243 .. function:: back(distance) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
244 bk(distance) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
245 backward(distance) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
246 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
247 :param distance: a number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
248 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
249 Move the turtle backward by *distance*, opposite to the direction the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
250 turtle is headed. Do not change the turtle's heading. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
251 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
252 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
253 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
254 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
255 >>> turtle.goto(0, 0) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
256 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
257 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
258 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
259 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
260 (0.00,0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
261 >>> turtle.backward(30) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
262 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
263 (-30.00,0.00) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
264 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
265 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
266 .. function:: right(angle) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
267 rt(angle) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
268 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
269 :param angle: a number (integer or float) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
270 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
271 Turn turtle right by *angle* units. (Units are by default degrees, but |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
272 can be set via the :func:`degrees` and :func:`radians` functions.) Angle |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
273 orientation depends on the turtle mode, see :func:`mode`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
274 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
275 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
276 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
277 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
278 >>> turtle.setheading(22) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
279 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
280 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
281 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
282 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
283 22.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
284 >>> turtle.right(45) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
285 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
286 337.0 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
287 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
288 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
289 .. function:: left(angle) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
290 lt(angle) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
291 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
292 :param angle: a number (integer or float) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
293 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
294 Turn turtle left by *angle* units. (Units are by default degrees, but |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
295 can be set via the :func:`degrees` and :func:`radians` functions.) Angle |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
296 orientation depends on the turtle mode, see :func:`mode`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
297 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
298 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
299 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
300 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
301 >>> turtle.setheading(22) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
302 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
303 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
304 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
305 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
306 22.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
307 >>> turtle.left(45) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
308 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
309 67.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
310 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
311 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
312 .. function:: goto(x, y=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
313 setpos(x, y=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
314 setposition(x, y=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
315 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
316 :param x: a number or a pair/vector of numbers |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
317 :param y: a number or ``None`` |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
318 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
319 If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
320 (e.g. as returned by :func:`pos`). |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
321 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
322 Move turtle to an absolute position. If the pen is down, draw line. Do |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
323 not change the turtle's orientation. |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
324 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
325 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
326 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
327 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
328 >>> turtle.goto(0, 0) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
329 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
330 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
331 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
332 >>> tp = turtle.pos() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
333 >>> tp |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
334 (0.00,0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
335 >>> turtle.setpos(60,30) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
336 >>> turtle.pos() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
337 (60.00,30.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
338 >>> turtle.setpos((20,80)) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
339 >>> turtle.pos() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
340 (20.00,80.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
341 >>> turtle.setpos(tp) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
342 >>> turtle.pos() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
343 (0.00,0.00) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
344 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
345 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
346 .. function:: setx(x) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
347 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
348 :param x: a number (integer or float) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
349 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
350 Set the turtle's first coordinate to *x*, leave second coordinate |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
351 unchanged. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
352 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
353 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
354 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
355 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
356 >>> turtle.goto(0, 240) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
357 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
358 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
359 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
360 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
361 (0.00,240.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
362 >>> turtle.setx(10) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
363 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
364 (10.00,240.00) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
365 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
366 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
367 .. function:: sety(y) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
368 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
369 :param y: a number (integer or float) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
370 |
|
50766
59b1212a4dbf
Note that first coord. is left alone
Andrew M. Kuchling <amk@amk.ca>
parents:
50757
diff
changeset
|
371 Set the turtle's second coordinate to *y*, leave first coordinate unchanged. |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
372 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
373 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
374 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
375 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
376 >>> turtle.goto(0, 40) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
377 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
378 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
379 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
380 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
381 (0.00,40.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
382 >>> turtle.sety(-10) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
383 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
384 (0.00,-10.00) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
385 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
386 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
387 .. function:: setheading(to_angle) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
388 seth(to_angle) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
389 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
390 :param to_angle: a number (integer or float) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
391 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
392 Set the orientation of the turtle to *to_angle*. Here are some common |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
393 directions in degrees: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
394 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
395 =================== ==================== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
396 standard mode logo mode |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
397 =================== ==================== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
398 0 - east 0 - north |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
399 90 - north 90 - east |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
400 180 - west 180 - south |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
401 270 - south 270 - west |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
402 =================== ==================== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
403 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
404 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
405 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
406 >>> turtle.setheading(90) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
407 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
408 90.0 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
409 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
410 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
411 .. function:: home() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
412 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
413 Move turtle to the origin -- coordinates (0,0) -- and set its heading to |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
414 its start-orientation (which depends on the mode, see :func:`mode`). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
415 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
416 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
417 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
418 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
419 >>> turtle.setheading(90) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
420 >>> turtle.goto(0, -10) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
421 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
422 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
423 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
424 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
425 90.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
426 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
427 (0.00,-10.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
428 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
429 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
430 (0.00,0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
431 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
432 0.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
433 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
434 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
435 .. function:: circle(radius, extent=None, steps=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
436 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
437 :param radius: a number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
438 :param extent: a number (or ``None``) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
439 :param steps: an integer (or ``None``) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
440 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
441 Draw a circle with given *radius*. The center is *radius* units left of |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
442 the turtle; *extent* -- an angle -- determines which part of the circle |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
443 is drawn. If *extent* is not given, draw the entire circle. If *extent* |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
444 is not a full circle, one endpoint of the arc is the current pen |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
445 position. Draw the arc in counterclockwise direction if *radius* is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
446 positive, otherwise in clockwise direction. Finally the direction of the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
447 turtle is changed by the amount of *extent*. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
448 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
449 As the circle is approximated by an inscribed regular polygon, *steps* |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
450 determines the number of steps to use. If not given, it will be |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
451 calculated automatically. May be used to draw regular polygons. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
452 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
453 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
454 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
455 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
456 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
457 (0.00,0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
458 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
459 0.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
460 >>> turtle.circle(50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
461 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
462 (-0.00,0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
463 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
464 0.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
465 >>> turtle.circle(120, 180) # draw a semicircle |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
466 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
467 (0.00,240.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
468 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
469 180.0 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
470 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
471 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
472 .. function:: dot(size=None, *color) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
473 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
474 :param size: an integer >= 1 (if given) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
475 :param color: a colorstring or a numeric color tuple |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
476 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
477 Draw a circular dot with diameter *size*, using *color*. If *size* is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
478 not given, the maximum of pensize+4 and 2*pensize is used. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
479 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
480 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
481 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
482 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
483 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
484 >>> turtle.dot() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
485 >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
486 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
487 (100.00,-0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
488 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
489 0.0 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
490 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
491 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
492 .. function:: stamp() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
493 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
494 Stamp a copy of the turtle shape onto the canvas at the current turtle |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
495 position. Return a stamp_id for that stamp, which can be used to delete |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
496 it by calling ``clearstamp(stamp_id)``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
497 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
498 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
499 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
500 >>> turtle.color("blue") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
501 >>> turtle.stamp() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
502 11 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
503 >>> turtle.fd(50) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
504 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
505 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
506 .. function:: clearstamp(stampid) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
507 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
508 :param stampid: an integer, must be return value of previous |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
509 :func:`stamp` call |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
510 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
511 Delete stamp with given *stampid*. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
512 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
513 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
514 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
515 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
516 (150.00,-0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
517 >>> turtle.color("blue") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
518 >>> astamp = turtle.stamp() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
519 >>> turtle.fd(50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
520 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
521 (200.00,-0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
522 >>> turtle.clearstamp(astamp) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
523 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
524 (200.00,-0.00) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
525 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
526 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
527 .. function:: clearstamps(n=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
528 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
529 :param n: an integer (or ``None``) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
530 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
531 Delete all or first/last *n* of turtle's stamps. If *n* is None, delete |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
532 all stamps, if *n* > 0 delete first *n* stamps, else if *n* < 0 delete |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
533 last *n* stamps. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
534 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
535 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
536 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
537 >>> for i in range(8): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
538 ... turtle.stamp(); turtle.fd(30) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
539 13 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
540 14 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
541 15 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
542 16 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
543 17 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
544 18 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
545 19 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
546 20 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
547 >>> turtle.clearstamps(2) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
548 >>> turtle.clearstamps(-2) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
549 >>> turtle.clearstamps() |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
550 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
551 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
552 .. function:: undo() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
553 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
554 Undo (repeatedly) the last turtle action(s). Number of available |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
555 undo actions is determined by the size of the undobuffer. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
556 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
557 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
558 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
559 >>> for i in range(4): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
560 ... turtle.fd(50); turtle.lt(80) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
561 ... |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
562 >>> for i in range(8): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
563 ... turtle.undo() |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
564 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
565 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
566 .. function:: speed(speed=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
567 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
568 :param speed: an integer in the range 0..10 or a speedstring (see below) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
569 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
570 Set the turtle's speed to an integer value in the range 0..10. If no |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
571 argument is given, return current speed. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
572 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
573 If input is a number greater than 10 or smaller than 0.5, speed is set |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
574 to 0. Speedstrings are mapped to speedvalues as follows: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
575 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
576 * "fastest": 0 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
577 * "fast": 10 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
578 * "normal": 6 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
579 * "slow": 3 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
580 * "slowest": 1 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
581 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
582 Speeds from 1 to 10 enforce increasingly faster animation of line drawing |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
583 and turtle turning. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
584 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
585 Attention: *speed* = 0 means that *no* animation takes |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
586 place. forward/back makes turtle jump and likewise left/right make the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
587 turtle turn instantly. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
588 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
589 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
590 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
591 >>> turtle.speed() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
592 3 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
593 >>> turtle.speed('normal') |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
594 >>> turtle.speed() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
595 6 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
596 >>> turtle.speed(9) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
597 >>> turtle.speed() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
598 9 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
599 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
600 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
601 Tell Turtle's state |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
602 ------------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
603 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
604 .. function:: position() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
605 pos() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
606 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
607 Return the turtle's current location (x,y) (as a :class:`Vec2D` vector). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
608 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
609 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
610 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
611 >>> turtle.pos() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
612 (440.00,-0.00) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
613 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
614 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
615 .. function:: towards(x, y=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
616 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
617 :param x: a number or a pair/vector of numbers or a turtle instance |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
618 :param y: a number if *x* is a number, else ``None`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
619 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
620 Return the angle between the line from turtle position to position specified |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
621 by (x,y), the vector or the other turtle. This depends on the turtle's start |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
622 orientation which depends on the mode - "standard"/"world" or "logo"). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
623 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
624 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
625 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
626 >>> turtle.goto(10, 10) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
627 >>> turtle.towards(0,0) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
628 225.0 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
629 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
630 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
631 .. function:: xcor() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
632 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
633 Return the turtle's x coordinate. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
634 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
635 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
636 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
637 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
638 >>> turtle.left(50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
639 >>> turtle.forward(100) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
640 >>> turtle.pos() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
641 (64.28,76.60) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
642 >>> print turtle.xcor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
643 64.2787609687 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
644 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
645 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
646 .. function:: ycor() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
647 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
648 Return the turtle's y coordinate. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
649 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
650 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
651 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
652 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
653 >>> turtle.left(60) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
654 >>> turtle.forward(100) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
655 >>> print turtle.pos() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
656 (50.00,86.60) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
657 >>> print turtle.ycor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
658 86.6025403784 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
659 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
660 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
661 .. function:: heading() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
662 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
663 Return the turtle's current heading (value depends on the turtle mode, see |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
664 :func:`mode`). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
665 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
666 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
667 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
668 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
669 >>> turtle.left(67) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
670 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
671 67.0 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
672 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
673 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
674 .. function:: distance(x, y=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
675 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
676 :param x: a number or a pair/vector of numbers or a turtle instance |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
677 :param y: a number if *x* is a number, else ``None`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
678 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
679 Return the distance from the turtle to (x,y), the given vector, or the given |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
680 other turtle, in turtle step units. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
681 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
682 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
683 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
684 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
685 >>> turtle.distance(30,40) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
686 50.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
687 >>> turtle.distance((30,40)) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
688 50.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
689 >>> joe = Turtle() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
690 >>> joe.forward(77) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
691 >>> turtle.distance(joe) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
692 77.0 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
693 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
694 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
695 Settings for measurement |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
696 ------------------------ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
697 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
698 .. function:: degrees(fullcircle=360.0) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
699 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
700 :param fullcircle: a number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
701 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
702 Set angle measurement units, i.e. set number of "degrees" for a full circle. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
703 Default value is 360 degrees. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
704 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
705 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
706 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
707 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
708 >>> turtle.left(90) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
709 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
710 90.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
711 >>> turtle.degrees(400.0) # angle measurement in gon |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
712 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
713 100.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
714 >>> turtle.degrees(360) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
715 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
716 90.0 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
717 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
718 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
719 .. function:: radians() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
720 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
721 Set the angle measurement units to radians. Equivalent to |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
722 ``degrees(2*math.pi)``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
723 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
724 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
725 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
726 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
727 >>> turtle.left(90) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
728 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
729 90.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
730 >>> turtle.radians() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
731 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
732 1.5707963267948966 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
733 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
734 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
735 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
736 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
737 >>> turtle.degrees(360) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
738 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
739 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
740 Pen control |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
741 ----------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
742 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
743 Drawing state |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
744 ~~~~~~~~~~~~~ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
745 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
746 .. function:: pendown() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
747 pd() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
748 down() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
749 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
750 Pull the pen down -- drawing when moving. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
751 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
752 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
753 .. function:: penup() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
754 pu() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
755 up() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
756 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
757 Pull the pen up -- no drawing when moving. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
758 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
759 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
760 .. function:: pensize(width=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
761 width(width=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
762 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
763 :param width: a positive number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
764 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
765 Set the line thickness to *width* or return it. If resizemode is set to |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
766 "auto" and turtleshape is a polygon, that polygon is drawn with the same line |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
767 thickness. If no argument is given, the current pensize is returned. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
768 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
769 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
770 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
771 >>> turtle.pensize() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
772 1 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
773 >>> turtle.pensize(10) # from here on lines of width 10 are drawn |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
774 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
775 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
776 .. function:: pen(pen=None, **pendict) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
777 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
778 :param pen: a dictionary with some or all of the below listed keys |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
779 :param pendict: one or more keyword-arguments with the below listed keys as keywords |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
780 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
781 Return or set the pen's attributes in a "pen-dictionary" with the following |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
782 key/value pairs: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
783 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
784 * "shown": True/False |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
785 * "pendown": True/False |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
786 * "pencolor": color-string or color-tuple |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
787 * "fillcolor": color-string or color-tuple |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
788 * "pensize": positive number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
789 * "speed": number in range 0..10 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
790 * "resizemode": "auto" or "user" or "noresize" |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
791 * "stretchfactor": (positive number, positive number) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
792 * "outline": positive number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
793 * "tilt": number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
794 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
795 This dictionary can be used as argument for a subsequent call to :func:`pen` |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
796 to restore the former pen-state. Moreover one or more of these attributes |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
797 can be provided as keyword-arguments. This can be used to set several pen |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
798 attributes in one statement. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
799 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
800 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
801 :options: +NORMALIZE_WHITESPACE |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
802 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
803 >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
804 >>> sorted(turtle.pen().items()) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
805 [('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'), |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
806 ('pendown', True), ('pensize', 10), ('resizemode', 'noresize'), |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
807 ('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)] |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
808 >>> penstate=turtle.pen() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
809 >>> turtle.color("yellow", "") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
810 >>> turtle.penup() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
811 >>> sorted(turtle.pen().items()) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
812 [('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow'), |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
813 ('pendown', False), ('pensize', 10), ('resizemode', 'noresize'), |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
814 ('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)] |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
815 >>> turtle.pen(penstate, fillcolor="green") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
816 >>> sorted(turtle.pen().items()) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
817 [('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red'), |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
818 ('pendown', True), ('pensize', 10), ('resizemode', 'noresize'), |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
819 ('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)] |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
820 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
821 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
822 .. function:: isdown() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
823 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
824 Return ``True`` if pen is down, ``False`` if it's up. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
825 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
826 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
827 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
828 >>> turtle.penup() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
829 >>> turtle.isdown() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
830 False |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
831 >>> turtle.pendown() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
832 >>> turtle.isdown() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
833 True |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
834 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
835 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
836 Color control |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
837 ~~~~~~~~~~~~~ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
838 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
839 .. function:: pencolor(*args) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
840 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
841 Return or set the pencolor. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
842 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
843 Four input formats are allowed: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
844 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
845 ``pencolor()`` |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
846 Return the current pencolor as color specification string or |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
847 as a tuple (see example). May be used as input to another |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
848 color/pencolor/fillcolor call. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
849 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
850 ``pencolor(colorstring)`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
851 Set pencolor to *colorstring*, which is a Tk color specification string, |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
852 such as ``"red"``, ``"yellow"``, or ``"#33cc8c"``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
853 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
854 ``pencolor((r, g, b))`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
855 Set pencolor to the RGB color represented by the tuple of *r*, *g*, and |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
856 *b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
857 colormode is either 1.0 or 255 (see :func:`colormode`). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
858 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
859 ``pencolor(r, g, b)`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
860 Set pencolor to the RGB color represented by *r*, *g*, and *b*. Each of |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
861 *r*, *g*, and *b* must be in the range 0..colormode. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
862 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
863 If turtleshape is a polygon, the outline of that polygon is drawn with the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
864 newly set pencolor. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
865 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
866 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
867 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
868 >>> colormode() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
869 1.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
870 >>> turtle.pencolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
871 'red' |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
872 >>> turtle.pencolor("brown") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
873 >>> turtle.pencolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
874 'brown' |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
875 >>> tup = (0.2, 0.8, 0.55) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
876 >>> turtle.pencolor(tup) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
877 >>> turtle.pencolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
878 (0.20000000000000001, 0.80000000000000004, 0.5490196078431373) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
879 >>> colormode(255) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
880 >>> turtle.pencolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
881 (51, 204, 140) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
882 >>> turtle.pencolor('#32c18f') |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
883 >>> turtle.pencolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
884 (50, 193, 143) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
885 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
886 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
887 .. function:: fillcolor(*args) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
888 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
889 Return or set the fillcolor. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
890 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
891 Four input formats are allowed: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
892 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
893 ``fillcolor()`` |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
894 Return the current fillcolor as color specification string, possibly |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
895 in tuple format (see example). May be used as input to another |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
896 color/pencolor/fillcolor call. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
897 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
898 ``fillcolor(colorstring)`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
899 Set fillcolor to *colorstring*, which is a Tk color specification string, |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
900 such as ``"red"``, ``"yellow"``, or ``"#33cc8c"``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
901 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
902 ``fillcolor((r, g, b))`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
903 Set fillcolor to the RGB color represented by the tuple of *r*, *g*, and |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
904 *b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
905 colormode is either 1.0 or 255 (see :func:`colormode`). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
906 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
907 ``fillcolor(r, g, b)`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
908 Set fillcolor to the RGB color represented by *r*, *g*, and *b*. Each of |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
909 *r*, *g*, and *b* must be in the range 0..colormode. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
910 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
911 If turtleshape is a polygon, the interior of that polygon is drawn |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
912 with the newly set fillcolor. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
913 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
914 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
915 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
916 >>> turtle.fillcolor("violet") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
917 >>> turtle.fillcolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
918 'violet' |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
919 >>> col = turtle.pencolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
920 >>> col |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
921 (50, 193, 143) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
922 >>> turtle.fillcolor(col) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
923 >>> turtle.fillcolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
924 (50, 193, 143) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
925 >>> turtle.fillcolor('#ffffff') |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
926 >>> turtle.fillcolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
927 (255, 255, 255) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
928 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
929 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
930 .. function:: color(*args) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
931 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
932 Return or set pencolor and fillcolor. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
933 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
934 Several input formats are allowed. They use 0 to 3 arguments as |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
935 follows: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
936 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
937 ``color()`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
938 Return the current pencolor and the current fillcolor as a pair of color |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
939 specification strings or tuples as returned by :func:`pencolor` and |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
940 :func:`fillcolor`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
941 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
942 ``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
943 Inputs as in :func:`pencolor`, set both, fillcolor and pencolor, to the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
944 given value. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
945 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
946 ``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
947 Equivalent to ``pencolor(colorstring1)`` and ``fillcolor(colorstring2)`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
948 and analogously if the other input format is used. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
949 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
950 If turtleshape is a polygon, outline and interior of that polygon is drawn |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
951 with the newly set colors. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
952 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
953 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
954 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
955 >>> turtle.color("red", "green") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
956 >>> turtle.color() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
957 ('red', 'green') |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
958 >>> color("#285078", "#a0c8f0") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
959 >>> color() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
960 ((40, 80, 120), (160, 200, 240)) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
961 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
962 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
963 See also: Screen method :func:`colormode`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
964 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
965 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
966 Filling |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
967 ~~~~~~~ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
968 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
969 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
970 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
971 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
972 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
973 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
974 .. function:: fill(flag) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
975 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
976 :param flag: True/False (or 1/0 respectively) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
977 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
978 Call ``fill(True)`` before drawing the shape you want to fill, and |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
979 ``fill(False)`` when done. When used without argument: return fillstate |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
980 (``True`` if filling, ``False`` else). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
981 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
982 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
983 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
984 >>> turtle.fill(True) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
985 >>> for _ in range(3): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
986 ... turtle.forward(100) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
987 ... turtle.left(120) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
988 ... |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
989 >>> turtle.fill(False) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
990 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
991 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
992 .. function:: begin_fill() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
993 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
994 Call just before drawing a shape to be filled. Equivalent to ``fill(True)``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
995 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
996 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
997 .. function:: end_fill() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
998 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
999 Fill the shape drawn after the last call to :func:`begin_fill`. Equivalent |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1000 to ``fill(False)``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1001 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1002 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1003 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1004 >>> turtle.color("black", "red") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1005 >>> turtle.begin_fill() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1006 >>> turtle.circle(80) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1007 >>> turtle.end_fill() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1008 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1009 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1010 More drawing control |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1011 ~~~~~~~~~~~~~~~~~~~~ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1012 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1013 .. function:: reset() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1014 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1015 Delete the turtle's drawings from the screen, re-center the turtle and set |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1016 variables to the default values. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1017 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1018 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1019 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1020 >>> turtle.goto(0,-22) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1021 >>> turtle.left(100) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1022 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1023 (0.00,-22.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1024 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1025 100.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1026 >>> turtle.reset() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1027 >>> turtle.position() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1028 (0.00,0.00) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1029 >>> turtle.heading() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1030 0.0 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1031 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1032 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1033 .. function:: clear() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1034 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1035 Delete the turtle's drawings from the screen. Do not move turtle. State and |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1036 position of the turtle as well as drawings of other turtles are not affected. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1037 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1038 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1039 .. function:: write(arg, move=False, align="left", font=("Arial", 8, "normal")) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1040 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1041 :param arg: object to be written to the TurtleScreen |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1042 :param move: True/False |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1043 :param align: one of the strings "left", "center" or right" |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1044 :param font: a triple (fontname, fontsize, fonttype) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1045 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1046 Write text - the string representation of *arg* - at the current turtle |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1047 position according to *align* ("left", "center" or right") and with the given |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1048 font. If *move* is True, the pen is moved to the bottom-right corner of the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1049 text. By default, *move* is False. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1050 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1051 >>> turtle.write("Home = ", True, align="center") |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1052 >>> turtle.write((0,0), True) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1053 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1054 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1055 Turtle state |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1056 ------------ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1057 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1058 Visibility |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1059 ~~~~~~~~~~ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1060 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1061 .. function:: hideturtle() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1062 ht() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1063 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1064 Make the turtle invisible. It's a good idea to do this while you're in the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1065 middle of doing some complex drawing, because hiding the turtle speeds up the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1066 drawing observably. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1067 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1068 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1069 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1070 >>> turtle.hideturtle() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1071 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1072 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1073 .. function:: showturtle() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1074 st() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1075 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1076 Make the turtle visible. |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1077 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1078 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1079 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1080 >>> turtle.showturtle() |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1081 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1082 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1083 .. function:: isvisible() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1084 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1085 Return True if the Turtle is shown, False if it's hidden. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1086 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1087 >>> turtle.hideturtle() |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1088 >>> turtle.isvisible() |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1089 False |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1090 >>> turtle.showturtle() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1091 >>> turtle.isvisible() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1092 True |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1093 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1094 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1095 Appearance |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1096 ~~~~~~~~~~ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1097 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1098 .. function:: shape(name=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1099 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1100 :param name: a string which is a valid shapename |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1101 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1102 Set turtle shape to shape with given *name* or, if name is not given, return |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1103 name of current shape. Shape with *name* must exist in the TurtleScreen's |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1104 shape dictionary. Initially there are the following polygon shapes: "arrow", |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1105 "turtle", "circle", "square", "triangle", "classic". To learn about how to |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1106 deal with shapes see Screen method :func:`register_shape`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1107 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1108 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1109 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1110 >>> turtle.shape() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1111 'classic' |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1112 >>> turtle.shape("turtle") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1113 >>> turtle.shape() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1114 'turtle' |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1115 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1116 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1117 .. function:: resizemode(rmode=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1118 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1119 :param rmode: one of the strings "auto", "user", "noresize" |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1120 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1121 Set resizemode to one of the values: "auto", "user", "noresize". If *rmode* |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1122 is not given, return current resizemode. Different resizemodes have the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1123 following effects: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1124 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1125 - "auto": adapts the appearance of the turtle corresponding to the value of pensize. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1126 - "user": adapts the appearance of the turtle according to the values of |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1127 stretchfactor and outlinewidth (outline), which are set by |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1128 :func:`shapesize`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1129 - "noresize": no adaption of the turtle's appearance takes place. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1130 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1131 resizemode("user") is called by :func:`shapesize` when used with arguments. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1132 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1133 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1134 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1135 >>> turtle.resizemode() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1136 'noresize' |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1137 >>> turtle.resizemode("auto") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1138 >>> turtle.resizemode() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1139 'auto' |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1140 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1141 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1142 .. function:: shapesize(stretch_wid=None, stretch_len=None, outline=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1143 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1144 :param stretch_wid: positive number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1145 :param stretch_len: positive number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1146 :param outline: positive number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1147 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1148 Return or set the pen's attributes x/y-stretchfactors and/or outline. Set |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1149 resizemode to "user". If and only if resizemode is set to "user", the turtle |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1150 will be displayed stretched according to its stretchfactors: *stretch_wid* is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1151 stretchfactor perpendicular to its orientation, *stretch_len* is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1152 stretchfactor in direction of its orientation, *outline* determines the width |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1153 of the shapes's outline. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1154 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1155 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1156 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1157 >>> turtle.shapesize() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1158 (1, 1, 1) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1159 >>> turtle.resizemode("user") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1160 >>> turtle.shapesize(5, 5, 12) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1161 >>> turtle.shapesize() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1162 (5, 5, 12) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1163 >>> turtle.shapesize(outline=8) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1164 >>> turtle.shapesize() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1165 (5, 5, 8) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1166 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1167 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1168 .. function:: tilt(angle) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1169 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1170 :param angle: a number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1171 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1172 Rotate the turtleshape by *angle* from its current tilt-angle, but do *not* |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1173 change the turtle's heading (direction of movement). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1174 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1175 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1176 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1177 >>> turtle.reset() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1178 >>> turtle.shape("circle") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1179 >>> turtle.shapesize(5,2) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1180 >>> turtle.tilt(30) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1181 >>> turtle.fd(50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1182 >>> turtle.tilt(30) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1183 >>> turtle.fd(50) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1184 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1185 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1186 .. function:: settiltangle(angle) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1187 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1188 :param angle: a number |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1189 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1190 Rotate the turtleshape to point in the direction specified by *angle*, |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1191 regardless of its current tilt-angle. *Do not* change the turtle's heading |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1192 (direction of movement). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1193 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1194 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1195 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1196 >>> turtle.reset() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1197 >>> turtle.shape("circle") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1198 >>> turtle.shapesize(5,2) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1199 >>> turtle.settiltangle(45) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1200 >>> turtle.fd(50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1201 >>> turtle.settiltangle(-45) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1202 >>> turtle.fd(50) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1203 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1204 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1205 .. function:: tiltangle() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1206 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1207 Return the current tilt-angle, i.e. the angle between the orientation of the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1208 turtleshape and the heading of the turtle (its direction of movement). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1209 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1210 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1211 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1212 >>> turtle.reset() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1213 >>> turtle.shape("circle") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1214 >>> turtle.shapesize(5,2) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1215 >>> turtle.tilt(45) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1216 >>> turtle.tiltangle() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1217 45.0 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1218 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1219 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1220 Using events |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1221 ------------ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1222 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1223 .. function:: onclick(fun, btn=1, add=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1224 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1225 :param fun: a function with two arguments which will be called with the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1226 coordinates of the clicked point on the canvas |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1227 :param num: number of the mouse-button, defaults to 1 (left mouse button) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1228 :param add: ``True`` or ``False`` -- if ``True``, a new binding will be |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1229 added, otherwise it will replace a former binding |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1230 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1231 Bind *fun* to mouse-click events on this turtle. If *fun* is ``None``, |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1232 existing bindings are removed. Example for the anonymous turtle, i.e. the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1233 procedural way: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1234 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1235 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1236 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1237 >>> def turn(x, y): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1238 ... left(180) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1239 ... |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1240 >>> onclick(turn) # Now clicking into the turtle will turn it. |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1241 >>> onclick(None) # event-binding will be removed |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1242 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1243 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1244 .. function:: onrelease(fun, btn=1, add=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1245 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1246 :param fun: a function with two arguments which will be called with the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1247 coordinates of the clicked point on the canvas |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1248 :param num: number of the mouse-button, defaults to 1 (left mouse button) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1249 :param add: ``True`` or ``False`` -- if ``True``, a new binding will be |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1250 added, otherwise it will replace a former binding |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1251 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1252 Bind *fun* to mouse-button-release events on this turtle. If *fun* is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1253 ``None``, existing bindings are removed. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1254 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1255 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1256 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1257 >>> class MyTurtle(Turtle): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1258 ... def glow(self,x,y): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1259 ... self.fillcolor("red") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1260 ... def unglow(self,x,y): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1261 ... self.fillcolor("") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1262 ... |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1263 >>> turtle = MyTurtle() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1264 >>> turtle.onclick(turtle.glow) # clicking on turtle turns fillcolor red, |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1265 >>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent. |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1266 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1267 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1268 .. function:: ondrag(fun, btn=1, add=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1269 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1270 :param fun: a function with two arguments which will be called with the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1271 coordinates of the clicked point on the canvas |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1272 :param num: number of the mouse-button, defaults to 1 (left mouse button) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1273 :param add: ``True`` or ``False`` -- if ``True``, a new binding will be |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1274 added, otherwise it will replace a former binding |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1275 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1276 Bind *fun* to mouse-move events on this turtle. If *fun* is ``None``, |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1277 existing bindings are removed. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1278 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1279 Remark: Every sequence of mouse-move-events on a turtle is preceded by a |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1280 mouse-click event on that turtle. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1281 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1282 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1283 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1284 >>> turtle.ondrag(turtle.goto) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1285 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1286 Subsequently, clicking and dragging the Turtle will move it across |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1287 the screen thereby producing handdrawings (if pen is down). |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1288 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1289 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1290 Special Turtle methods |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1291 ---------------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1292 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1293 .. function:: begin_poly() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1294 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1295 Start recording the vertices of a polygon. Current turtle position is first |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1296 vertex of polygon. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1297 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1298 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1299 .. function:: end_poly() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1300 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1301 Stop recording the vertices of a polygon. Current turtle position is last |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1302 vertex of polygon. This will be connected with the first vertex. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1303 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1304 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1305 .. function:: get_poly() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1306 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1307 Return the last recorded polygon. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1308 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1309 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1310 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1311 >>> turtle.home() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1312 >>> turtle.begin_poly() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1313 >>> turtle.fd(100) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1314 >>> turtle.left(20) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1315 >>> turtle.fd(30) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1316 >>> turtle.left(60) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1317 >>> turtle.fd(50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1318 >>> turtle.end_poly() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1319 >>> p = turtle.get_poly() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1320 >>> register_shape("myFavouriteShape", p) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1321 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1322 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1323 .. function:: clone() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1324 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1325 Create and return a clone of the turtle with same position, heading and |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1326 turtle properties. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1327 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1328 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1329 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1330 >>> mick = Turtle() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1331 >>> joe = mick.clone() |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1332 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1333 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1334 .. function:: getturtle() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1335 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1336 Return the Turtle object itself. Only reasonable use: as a function to |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1337 return the "anonymous turtle": |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1338 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1339 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1340 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1341 >>> pet = getturtle() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1342 >>> pet.fd(50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1343 >>> pet |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1344 <turtle.Turtle object at 0x...> |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1345 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1346 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1347 .. function:: getscreen() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1348 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1349 Return the :class:`TurtleScreen` object the turtle is drawing on. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1350 TurtleScreen methods can then be called for that object. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1351 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1352 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1353 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1354 >>> ts = turtle.getscreen() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1355 >>> ts |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1356 <turtle._Screen object at 0x...> |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1357 >>> ts.bgcolor("pink") |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1358 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1359 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1360 .. function:: setundobuffer(size) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1361 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1362 :param size: an integer or ``None`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1363 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1364 Set or disable undobuffer. If *size* is an integer an empty undobuffer of |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1365 given size is installed. *size* gives the maximum number of turtle actions |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1366 that can be undone by the :func:`undo` method/function. If *size* is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1367 ``None``, the undobuffer is disabled. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1368 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1369 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1370 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1371 >>> turtle.setundobuffer(42) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1372 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1373 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1374 .. function:: undobufferentries() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1375 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1376 Return number of entries in the undobuffer. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1377 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1378 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1379 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1380 >>> while undobufferentries(): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1381 ... undo() |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1382 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1383 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1384 .. function:: tracer(flag=None, delay=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1385 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1386 A replica of the corresponding TurtleScreen method. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1387 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1388 .. deprecated:: 2.6 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1389 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1390 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1391 .. function:: window_width() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1392 window_height() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1393 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1394 Both are replicas of the corresponding TurtleScreen methods. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1395 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1396 .. deprecated:: 2.6 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1397 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1398 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1399 .. _compoundshapes: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1400 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1401 Excursus about the use of compound shapes |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1402 ----------------------------------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1403 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1404 To use compound turtle shapes, which consist of several polygons of different |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1405 color, you must use the helper class :class:`Shape` explicitly as described |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1406 below: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1407 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1408 1. Create an empty Shape object of type "compound". |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1409 2. Add as many components to this object as desired, using the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1410 :meth:`addcomponent` method. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1411 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1412 For example: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1413 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1414 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1415 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1416 >>> s = Shape("compound") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1417 >>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5)) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1418 >>> s.addcomponent(poly1, "red", "blue") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1419 >>> poly2 = ((0,0),(10,-5),(-10,-5)) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1420 >>> s.addcomponent(poly2, "blue", "red") |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1421 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1422 3. Now add the Shape to the Screen's shapelist and use it: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1423 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1424 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1425 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1426 >>> register_shape("myshape", s) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1427 >>> shape("myshape") |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1428 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1429 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1430 .. note:: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1431 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1432 The :class:`Shape` class is used internally by the :func:`register_shape` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1433 method in different ways. The application programmer has to deal with the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1434 Shape class *only* when using compound shapes like shown above! |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1435 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1436 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1437 Methods of TurtleScreen/Screen and corresponding functions |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1438 ========================================================== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1439 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1440 Most of the examples in this section refer to a TurtleScreen instance called |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1441 ``screen``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1442 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1443 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1444 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1445 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1446 >>> screen = Screen() |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1447 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1448 Window control |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1449 -------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1450 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1451 .. function:: bgcolor(*args) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1452 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1453 :param args: a color string or three numbers in the range 0..colormode or a |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1454 3-tuple of such numbers |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1455 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1456 Set or return background color of the TurtleScreen. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1457 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1458 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1459 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1460 >>> screen.bgcolor("orange") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1461 >>> screen.bgcolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1462 'orange' |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1463 >>> screen.bgcolor("#800080") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1464 >>> screen.bgcolor() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1465 (128, 0, 128) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1466 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1467 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1468 .. function:: bgpic(picname=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1469 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1470 :param picname: a string, name of a gif-file or ``"nopic"``, or ``None`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1471 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1472 Set background image or return name of current backgroundimage. If *picname* |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1473 is a filename, set the corresponding image as background. If *picname* is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1474 ``"nopic"``, delete background image, if present. If *picname* is ``None``, |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1475 return the filename of the current backgroundimage. :: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1476 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1477 >>> screen.bgpic() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1478 'nopic' |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1479 >>> screen.bgpic("landscape.gif") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1480 >>> screen.bgpic() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1481 "landscape.gif" |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1482 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1483 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1484 .. function:: clear() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1485 clearscreen() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1486 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1487 Delete all drawings and all turtles from the TurtleScreen. Reset the now |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1488 empty TurtleScreen to its initial state: white background, no background |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1489 image, no event bindings and tracing on. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1490 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1491 .. note:: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1492 This TurtleScreen method is available as a global function only under the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1493 name ``clearscreen``. The global function ``clear`` is another one |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1494 derived from the Turtle method ``clear``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1495 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1496 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1497 .. function:: reset() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1498 resetscreen() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1499 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1500 Reset all Turtles on the Screen to their initial state. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1501 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1502 .. note:: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1503 This TurtleScreen method is available as a global function only under the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1504 name ``resetscreen``. The global function ``reset`` is another one |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1505 derived from the Turtle method ``reset``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1506 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1507 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1508 .. function:: screensize(canvwidth=None, canvheight=None, bg=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1509 |
| 53329 | 1510 :param canvwidth: positive integer, new width of canvas in pixels |
| 1511 :param canvheight: positive integer, new height of canvas in pixels | |
| 1512 :param bg: colorstring or color-tuple, new background color | |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1513 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1514 If no arguments are given, return current (canvaswidth, canvasheight). Else |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1515 resize the canvas the turtles are drawing on. Do not alter the drawing |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1516 window. To observe hidden parts of the canvas, use the scrollbars. With this |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1517 method, one can make visible those parts of a drawing which were outside the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1518 canvas before. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1519 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1520 >>> screen.screensize() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1521 (400, 300) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1522 >>> screen.screensize(2000,1500) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1523 >>> screen.screensize() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1524 (2000, 1500) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1525 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1526 e.g. to search for an erroneously escaped turtle ;-) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1527 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1528 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1529 .. function:: setworldcoordinates(llx, lly, urx, ury) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1530 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1531 :param llx: a number, x-coordinate of lower left corner of canvas |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1532 :param lly: a number, y-coordinate of lower left corner of canvas |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1533 :param urx: a number, x-coordinate of upper right corner of canvas |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1534 :param ury: a number, y-coordinate of upper right corner of canvas |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1535 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1536 Set up user-defined coordinate system and switch to mode "world" if |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1537 necessary. This performs a ``screen.reset()``. If mode "world" is already |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1538 active, all drawings are redrawn according to the new coordinates. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1539 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1540 **ATTENTION**: in user-defined coordinate systems angles may appear |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1541 distorted. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1542 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1543 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1544 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1545 >>> screen.reset() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1546 >>> screen.setworldcoordinates(-50,-7.5,50,7.5) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1547 >>> for _ in range(72): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1548 ... left(10) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1549 ... |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1550 >>> for _ in range(8): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1551 ... left(45); fd(2) # a regular octagon |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1552 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1553 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1554 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1555 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1556 >>> screen.reset() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1557 >>> for t in turtles(): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1558 ... t.reset() |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1559 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1560 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1561 Animation control |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1562 ----------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1563 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1564 .. function:: delay(delay=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1565 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1566 :param delay: positive integer |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1567 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1568 Set or return the drawing *delay* in milliseconds. (This is approximately |
|
47937
38d3a50defec
fix various doc typos #3320
Benjamin Peterson <benjamin@python.org>
parents:
47460
diff
changeset
|
1569 the time interval between two consecutive canvas updates.) The longer the |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1570 drawing delay, the slower the animation. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1571 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1572 Optional argument: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1573 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1574 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1575 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1576 >>> screen.delay() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1577 10 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1578 >>> screen.delay(5) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1579 >>> screen.delay() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1580 5 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1581 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1582 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1583 .. function:: tracer(n=None, delay=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1584 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1585 :param n: nonnegative integer |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1586 :param delay: nonnegative integer |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1587 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1588 Turn turtle animation on/off and set delay for update drawings. If *n* is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1589 given, only each n-th regular screen update is really performed. (Can be |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1590 used to accelerate the drawing of complex graphics.) Second argument sets |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1591 delay value (see :func:`delay`). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1592 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1593 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1594 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1595 >>> screen.tracer(8, 25) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1596 >>> dist = 2 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1597 >>> for i in range(200): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1598 ... fd(dist) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1599 ... rt(90) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1600 ... dist += 2 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1601 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1602 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1603 .. function:: update() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1604 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1605 Perform a TurtleScreen update. To be used when tracer is turned off. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1606 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1607 See also the RawTurtle/Turtle method :func:`speed`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1608 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1609 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1610 Using screen events |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1611 ------------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1612 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1613 .. function:: listen(xdummy=None, ydummy=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1614 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1615 Set focus on TurtleScreen (in order to collect key-events). Dummy arguments |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1616 are provided in order to be able to pass :func:`listen` to the onclick method. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1617 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1618 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1619 .. function:: onkey(fun, key) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1620 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1621 :param fun: a function with no arguments or ``None`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1622 :param key: a string: key (e.g. "a") or key-symbol (e.g. "space") |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1623 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1624 Bind *fun* to key-release event of key. If *fun* is ``None``, event bindings |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1625 are removed. Remark: in order to be able to register key-events, TurtleScreen |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1626 must have the focus. (See method :func:`listen`.) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1627 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1628 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1629 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1630 >>> def f(): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1631 ... fd(50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1632 ... lt(60) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1633 ... |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1634 >>> screen.onkey(f, "Up") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1635 >>> screen.listen() |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1636 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1637 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1638 .. function:: onclick(fun, btn=1, add=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1639 onscreenclick(fun, btn=1, add=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1640 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1641 :param fun: a function with two arguments which will be called with the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1642 coordinates of the clicked point on the canvas |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1643 :param num: number of the mouse-button, defaults to 1 (left mouse button) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1644 :param add: ``True`` or ``False`` -- if ``True``, a new binding will be |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1645 added, otherwise it will replace a former binding |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1646 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1647 Bind *fun* to mouse-click events on this screen. If *fun* is ``None``, |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1648 existing bindings are removed. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1649 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1650 Example for a TurtleScreen instance named ``screen`` and a Turtle instance |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1651 named turtle: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1652 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1653 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1654 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1655 >>> screen.onclick(turtle.goto) # Subsequently clicking into the TurtleScreen will |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1656 >>> # make the turtle move to the clicked point. |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1657 >>> screen.onclick(None) # remove event binding again |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1658 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1659 .. note:: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1660 This TurtleScreen method is available as a global function only under the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1661 name ``onscreenclick``. The global function ``onclick`` is another one |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1662 derived from the Turtle method ``onclick``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1663 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1664 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1665 .. function:: ontimer(fun, t=0) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1666 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1667 :param fun: a function with no arguments |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1668 :param t: a number >= 0 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1669 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1670 Install a timer that calls *fun* after *t* milliseconds. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1671 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1672 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1673 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1674 >>> running = True |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1675 >>> def f(): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1676 ... if running: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1677 ... fd(50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1678 ... lt(60) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1679 ... screen.ontimer(f, 250) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1680 >>> f() ### makes the turtle march around |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1681 >>> running = False |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1682 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1683 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1684 Settings and special methods |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1685 ---------------------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1686 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1687 .. function:: mode(mode=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1688 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1689 :param mode: one of the strings "standard", "logo" or "world" |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1690 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1691 Set turtle mode ("standard", "logo" or "world") and perform reset. If mode |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1692 is not given, current mode is returned. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1693 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1694 Mode "standard" is compatible with old :mod:`turtle`. Mode "logo" is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1695 compatible with most Logo turtle graphics. Mode "world" uses user-defined |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1696 "world coordinates". **Attention**: in this mode angles appear distorted if |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1697 ``x/y`` unit-ratio doesn't equal 1. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1698 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1699 ============ ========================= =================== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1700 Mode Initial turtle heading positive angles |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1701 ============ ========================= =================== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1702 "standard" to the right (east) counterclockwise |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1703 "logo" upward (north) clockwise |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1704 ============ ========================= =================== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1705 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1706 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1707 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1708 >>> mode("logo") # resets turtle heading to north |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1709 >>> mode() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1710 'logo' |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1711 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1712 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1713 .. function:: colormode(cmode=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1714 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1715 :param cmode: one of the values 1.0 or 255 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1716 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1717 Return the colormode or set it to 1.0 or 255. Subsequently *r*, *g*, *b* |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1718 values of color triples have to be in the range 0..\ *cmode*. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1719 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1720 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1721 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1722 >>> screen.colormode(1) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1723 >>> turtle.pencolor(240, 160, 80) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1724 Traceback (most recent call last): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1725 ... |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1726 TurtleGraphicsError: bad color sequence: (240, 160, 80) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1727 >>> screen.colormode() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1728 1.0 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1729 >>> screen.colormode(255) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1730 >>> screen.colormode() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1731 255 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1732 >>> turtle.pencolor(240,160,80) |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1733 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1734 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1735 .. function:: getcanvas() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1736 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1737 Return the Canvas of this TurtleScreen. Useful for insiders who know what to |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1738 do with a Tkinter Canvas. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1739 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1740 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1741 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1742 >>> cv = screen.getcanvas() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1743 >>> cv |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1744 <turtle.ScrolledCanvas instance at 0x...> |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1745 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1746 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1747 .. function:: getshapes() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1748 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1749 Return a list of names of all currently available turtle shapes. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1750 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1751 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1752 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1753 >>> screen.getshapes() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1754 ['arrow', 'blank', 'circle', ..., 'turtle'] |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1755 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1756 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1757 .. function:: register_shape(name, shape=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1758 addshape(name, shape=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1759 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1760 There are three different ways to call this function: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1761 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1762 (1) *name* is the name of a gif-file and *shape* is ``None``: Install the |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1763 corresponding image shape. :: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1764 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1765 >>> screen.register_shape("turtle.gif") |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1766 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1767 .. note:: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1768 Image shapes *do not* rotate when turning the turtle, so they do not |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1769 display the heading of the turtle! |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1770 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1771 (2) *name* is an arbitrary string and *shape* is a tuple of pairs of |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1772 coordinates: Install the corresponding polygon shape. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1773 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1774 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1775 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1776 >>> screen.register_shape("triangle", ((5,-3), (0,5), (-5,-3))) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1777 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1778 (3) *name* is an arbitrary string and shape is a (compound) :class:`Shape` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1779 object: Install the corresponding compound shape. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1780 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1781 Add a turtle shape to TurtleScreen's shapelist. Only thusly registered |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1782 shapes can be used by issuing the command ``shape(shapename)``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1783 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1784 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1785 .. function:: turtles() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1786 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1787 Return the list of turtles on the screen. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1788 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1789 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1790 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1791 >>> for turtle in screen.turtles(): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1792 ... turtle.color("red") |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1793 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1794 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1795 .. function:: window_height() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1796 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1797 Return the height of the turtle window. :: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1798 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1799 >>> screen.window_height() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1800 480 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1801 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1802 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1803 .. function:: window_width() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1804 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1805 Return the width of the turtle window. :: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1806 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1807 >>> screen.window_width() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1808 640 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1809 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1810 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1811 .. _screenspecific: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1812 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1813 Methods specific to Screen, not inherited from TurtleScreen |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1814 ----------------------------------------------------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1815 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1816 .. function:: bye() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1817 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1818 Shut the turtlegraphics window. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1819 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1820 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1821 .. function:: exitonclick() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1822 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1823 Bind bye() method to mouse clicks on the Screen. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1824 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1825 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1826 If the value "using_IDLE" in the configuration dictionary is ``False`` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1827 (default value), also enter mainloop. Remark: If IDLE with the ``-n`` switch |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1828 (no subprocess) is used, this value should be set to ``True`` in |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1829 :file:`turtle.cfg`. In this case IDLE's own mainloop is active also for the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1830 client script. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1831 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1832 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1833 .. function:: setup(width=_CFG["width"], height=_CFG["height"], startx=_CFG["leftright"], starty=_CFG["topbottom"]) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1834 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1835 Set the size and position of the main window. Default values of arguments |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1836 are stored in the configuration dicionary and can be changed via a |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1837 :file:`turtle.cfg` file. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1838 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1839 :param width: if an integer, a size in pixels, if a float, a fraction of the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1840 screen; default is 50% of screen |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1841 :param height: if an integer, the height in pixels, if a float, a fraction of |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1842 the screen; default is 75% of screen |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1843 :param startx: if positive, starting position in pixels from the left |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1844 edge of the screen, if negative from the right edge, if None, |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1845 center window horizontally |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1846 :param startx: if positive, starting position in pixels from the top |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1847 edge of the screen, if negative from the bottom edge, if None, |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1848 center window vertically |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1849 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1850 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1851 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1852 >>> screen.setup (width=200, height=200, startx=0, starty=0) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1853 >>> # sets window to 200x200 pixels, in upper left of screen |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1854 >>> screen.setup(width=.75, height=0.5, startx=None, starty=None) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1855 >>> # sets window to 75% of screen by 50% of screen and centers |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1856 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1857 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1858 .. function:: title(titlestring) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1859 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1860 :param titlestring: a string that is shown in the titlebar of the turtle |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1861 graphics window |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1862 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1863 Set title of turtle window to *titlestring*. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1864 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1865 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1866 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1867 >>> screen.title("Welcome to the turtle zoo!") |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1868 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1869 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1870 The public classes of the module :mod:`turtle` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1871 ============================================== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1872 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1873 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1874 .. class:: RawTurtle(canvas) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1875 RawPen(canvas) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1876 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1877 :param canvas: a :class:`Tkinter.Canvas`, a :class:`ScrolledCanvas` or a |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1878 :class:`TurtleScreen` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1879 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1880 Create a turtle. The turtle has all methods described above as "methods of |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1881 Turtle/RawTurtle". |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1882 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1883 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1884 .. class:: Turtle() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1885 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1886 Subclass of RawTurtle, has the same interface but draws on a default |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1887 :class:`Screen` object created automatically when needed for the first time. |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1888 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1889 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1890 .. class:: TurtleScreen(cv) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1891 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1892 :param cv: a :class:`Tkinter.Canvas` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1893 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1894 Provides screen oriented methods like :func:`setbg` etc. that are described |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1895 above. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1896 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1897 .. class:: Screen() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1898 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1899 Subclass of TurtleScreen, with :ref:`four methods added <screenspecific>`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1900 |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
1901 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1902 .. class:: ScrolledCavas(master) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1903 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1904 :param master: some Tkinter widget to contain the ScrolledCanvas, i.e. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1905 a Tkinter-canvas with scrollbars added |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1906 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1907 Used by class Screen, which thus automatically provides a ScrolledCanvas as |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1908 playground for the turtles. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1909 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1910 .. class:: Shape(type_, data) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1911 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1912 :param type\_: one of the strings "polygon", "image", "compound" |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1913 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1914 Data structure modeling shapes. The pair ``(type_, data)`` must follow this |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1915 specification: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1916 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1917 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1918 =========== =========== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1919 *type_* *data* |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1920 =========== =========== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1921 "polygon" a polygon-tuple, i.e. a tuple of pairs of coordinates |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1922 "image" an image (in this form only used internally!) |
| 52143 | 1923 "compound" ``None`` (a compound shape has to be constructed using the |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1924 :meth:`addcomponent` method) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1925 =========== =========== |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
1926 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1927 .. method:: addcomponent(poly, fill, outline=None) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1928 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1929 :param poly: a polygon, i.e. a tuple of pairs of numbers |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1930 :param fill: a color the *poly* will be filled with |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1931 :param outline: a color for the poly's outline (if given) |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
1932 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1933 Example: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1934 |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1935 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1936 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1937 >>> poly = ((0,0),(10,-5),(0,10),(-10,-5)) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1938 >>> s = Shape("compound") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1939 >>> s.addcomponent(poly, "red", "blue") |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
1940 >>> # ... add more components and then use register_shape() |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1941 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1942 See :ref:`compoundshapes`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1943 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1944 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1945 .. class:: Vec2D(x, y) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1946 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1947 A two-dimensional vector class, used as a helper class for implementing |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1948 turtle graphics. May be useful for turtle graphics programs too. Derived |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1949 from tuple, so a vector is a tuple! |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1950 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1951 Provides (for *a*, *b* vectors, *k* number): |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1952 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1953 * ``a + b`` vector addition |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1954 * ``a - b`` vector subtraction |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1955 * ``a * b`` inner product |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1956 * ``k * a`` and ``a * k`` multiplication with scalar |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1957 * ``abs(a)`` absolute value of a |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1958 * ``a.rotate(angle)`` rotation |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1959 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1960 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1961 Help and configuration |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1962 ====================== |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1963 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1964 How to use help |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1965 --------------- |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1966 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1967 The public methods of the Screen and Turtle classes are documented extensively |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1968 via docstrings. So these can be used as online-help via the Python help |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1969 facilities: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1970 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1971 - When using IDLE, tooltips show the signatures and first lines of the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1972 docstrings of typed in function-/method calls. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1973 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1974 - Calling :func:`help` on methods or functions displays the docstrings:: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1975 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1976 >>> help(Screen.bgcolor) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1977 Help on method bgcolor in module turtle: |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
1978 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1979 bgcolor(self, *args) unbound turtle.Screen method |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1980 Set or return backgroundcolor of the TurtleScreen. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
1981 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1982 Arguments (if given): a color string or three numbers |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1983 in the range 0..colormode or a 3-tuple of such numbers. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
1984 |
|
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
1985 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1986 >>> screen.bgcolor("orange") |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1987 >>> screen.bgcolor() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1988 "orange" |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1989 >>> screen.bgcolor(0.5,0,0.5) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1990 >>> screen.bgcolor() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1991 "#800080" |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
1992 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1993 >>> help(Turtle.penup) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1994 Help on method penup in module turtle: |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
1995 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1996 penup(self) unbound turtle.Turtle method |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1997 Pull the pen up -- no drawing when moving. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
1998 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
1999 Aliases: penup | pu | up |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2000 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2001 No argument |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2002 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2003 >>> turtle.penup() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2004 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2005 - The docstrings of the functions which are derived from methods have a modified |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2006 form:: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2007 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2008 >>> help(bgcolor) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2009 Help on function bgcolor in module turtle: |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2010 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2011 bgcolor(*args) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2012 Set or return backgroundcolor of the TurtleScreen. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2013 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2014 Arguments (if given): a color string or three numbers |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2015 in the range 0..colormode or a 3-tuple of such numbers. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2016 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2017 Example:: |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2018 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2019 >>> bgcolor("orange") |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2020 >>> bgcolor() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2021 "orange" |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2022 >>> bgcolor(0.5,0,0.5) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2023 >>> bgcolor() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2024 "#800080" |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2025 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2026 >>> help(penup) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2027 Help on function penup in module turtle: |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2028 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2029 penup() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2030 Pull the pen up -- no drawing when moving. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2031 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2032 Aliases: penup | pu | up |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2033 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2034 No argument |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49344
diff
changeset
|
2035 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2036 Example: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2037 >>> penup() |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2038 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2039 These modified docstrings are created automatically together with the function |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2040 definitions that are derived from the methods at import time. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2041 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2042 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2043 Translation of docstrings into different languages |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2044 -------------------------------------------------- |
|
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2045 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2046 There is a utility to create a dictionary the keys of which are the method names |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2047 and the values of which are the docstrings of the public methods of the classes |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2048 Screen and Turtle. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2049 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2050 .. function:: write_docstringdict(filename="turtle_docstringdict") |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2051 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2052 :param filename: a string, used as filename |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2053 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2054 Create and write docstring-dictionary to a Python script with the given |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2055 filename. This function has to be called explicitly (it is not used by the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2056 turtle graphics classes). The docstring dictionary will be written to the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2057 Python script :file:`{filename}.py`. It is intended to serve as a template |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2058 for translation of the docstrings into different languages. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2059 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2060 If you (or your students) want to use :mod:`turtle` with online help in your |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2061 native language, you have to translate the docstrings and save the resulting |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2062 file as e.g. :file:`turtle_docstringdict_german.py`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2063 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2064 If you have an appropriate entry in your :file:`turtle.cfg` file this dictionary |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2065 will be read in at import time and will replace the original English docstrings. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2066 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2067 At the time of this writing there are docstring dictionaries in German and in |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2068 Italian. (Requests please to glingl@aon.at.) |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2069 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2070 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2071 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2072 How to configure Screen and Turtles |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2073 ----------------------------------- |
|
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2074 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2075 The built-in default configuration mimics the appearance and behaviour of the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2076 old turtle module in order to retain best possible compatibility with it. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2077 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2078 If you want to use a different configuration which better reflects the features |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2079 of this module or which better fits to your needs, e.g. for use in a classroom, |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2080 you can prepare a configuration file ``turtle.cfg`` which will be read at import |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2081 time and modify the configuration according to its settings. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2082 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2083 The built in configuration would correspond to the following turtle.cfg:: |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2084 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2085 width = 0.5 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2086 height = 0.75 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2087 leftright = None |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2088 topbottom = None |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2089 canvwidth = 400 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2090 canvheight = 300 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2091 mode = standard |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2092 colormode = 1.0 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2093 delay = 10 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2094 undobuffersize = 1000 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2095 shape = classic |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2096 pencolor = black |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2097 fillcolor = black |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2098 resizemode = noresize |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2099 visible = True |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2100 language = english |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2101 exampleturtle = turtle |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2102 examplescreen = screen |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2103 title = Python Turtle Graphics |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2104 using_IDLE = False |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2105 |
|
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2106 Short explanation of selected entries: |
|
47183
b53604fad54b
Tkinter rename reversal: remove tkinter package, adapt imports and docs.
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
2107 |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2108 - The first four lines correspond to the arguments of the :meth:`Screen.setup` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2109 method. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2110 - Line 5 and 6 correspond to the arguments of the method |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2111 :meth:`Screen.screensize`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2112 - *shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For more |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2113 info try ``help(shape)``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2114 - If you want to use no fillcolor (i.e. make the turtle transparent), you have |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2115 to write ``fillcolor = ""`` (but all nonempty strings must not have quotes in |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2116 the cfg-file). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2117 - If you want to reflect the turtle its state, you have to use ``resizemode = |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2118 auto``. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2119 - If you set e.g. ``language = italian`` the docstringdict |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2120 :file:`turtle_docstringdict_italian.py` will be loaded at import time (if |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2121 present on the import path, e.g. in the same directory as :mod:`turtle`. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2122 - The entries *exampleturtle* and *examplescreen* define the names of these |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2123 objects as they occur in the docstrings. The transformation of |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2124 method-docstrings to function-docstrings will delete these names from the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2125 docstrings. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2126 - *using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its -n |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2127 switch ("no subprocess"). This will prevent :func:`exitonclick` to enter the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2128 mainloop. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2129 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2130 There can be a :file:`turtle.cfg` file in the directory where :mod:`turtle` is |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2131 stored and an additional one in the current working directory. The latter will |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2132 override the settings of the first one. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2133 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2134 The :file:`Demo/turtle` directory contains a :file:`turtle.cfg` file. You can |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2135 study it as an example and see its effects when running the demos (preferably |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2136 not from within the demo-viewer). |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2137 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2138 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2139 Demo scripts |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2140 ============ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2141 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2142 There is a set of demo scripts in the turtledemo directory located in the |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2143 :file:`Demo/turtle` directory in the source distribution. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2144 |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2145 It contains: |
|
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2146 |
| 52143 | 2147 - a set of 15 demo scripts demonstrating different features of the new module |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2148 :mod:`turtle` |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2149 - a demo viewer :file:`turtleDemo.py` which can be used to view the sourcecode |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2150 of the scripts and run them at the same time. 14 of the examples can be |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2151 accessed via the Examples menu; all of them can also be run standalone. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2152 - The example :file:`turtledemo_two_canvases.py` demonstrates the simultaneous |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2153 use of two canvases with the turtle module. Therefore it only can be run |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2154 standalone. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2155 - There is a :file:`turtle.cfg` file in this directory, which also serves as an |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2156 example for how to write and use such files. |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2157 |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2158 The demoscripts are: |
|
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2159 |
|
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2160 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2161 | Name | Description | Features | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2162 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2163 | bytedesign | complex classical | :func:`tracer`, delay,| |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2164 | | turtlegraphics pattern | :func:`update` | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2165 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2166 | chaos | graphs verhust dynamics, | world coordinates | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2167 | | proves that you must not | | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2168 | | trust computers' computations| | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2169 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2170 | clock | analog clock showing time | turtles as clock's | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2171 | | of your computer | hands, ontimer | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2172 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2173 | colormixer | experiment with r, g, b | :func:`ondrag` | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2174 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2175 | fractalcurves | Hilbert & Koch curves | recursion | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2176 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2177 | lindenmayer | ethnomathematics | L-System | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2178 | | (indian kolams) | | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2179 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2180 | minimal_hanoi | Towers of Hanoi | Rectangular Turtles | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2181 | | | as Hanoi discs | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2182 | | | (shape, shapesize) | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2183 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2184 | paint | super minimalistic | :func:`onclick` | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2185 | | drawing program | | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2186 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2187 | peace | elementary | turtle: appearance | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2188 | | | and animation | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2189 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2190 | penrose | aperiodic tiling with | :func:`stamp` | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2191 | | kites and darts | | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2192 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2193 | planet_and_moon| simulation of | compound shapes, | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2194 | | gravitational system | :class:`Vec2D` | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2195 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2196 | tree | a (graphical) breadth | :func:`clone` | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2197 | | first tree (using generators)| | |
|
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2198 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2199 | wikipedia | a pattern from the wikipedia | :func:`clone`, | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2200 | | article on turtle graphics | :func:`undo` | |
|
47459
ef0cccde8c24
Patch #1513695: New turtle module, with demos.
Martin v. Löwis <martin@v.loewis.de>
parents:
47183
diff
changeset
|
2201 +----------------+------------------------------+-----------------------+ |
|
47460
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2202 | yingyang | another elementary example | :func:`circle` | |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2203 +----------------+------------------------------+-----------------------+ |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2204 |
|
2a1c6978dc57
Complete revision of new turtle module's docs.
Georg Brandl <georg@python.org>
parents:
47459
diff
changeset
|
2205 Have fun! |
|
53635
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2206 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2207 .. doctest:: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2208 :hide: |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2209 |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2210 >>> for turtle in turtles(): |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2211 ... turtle.reset() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2212 >>> turtle.penup() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2213 >>> turtle.goto(-200,25) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2214 >>> turtle.pendown() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2215 >>> turtle.write("No one expects the Spanish Inquisition!", |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2216 ... font=("Arial", 20, "normal")) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2217 >>> turtle.penup() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2218 >>> turtle.goto(-100,-50) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2219 >>> turtle.pendown() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2220 >>> turtle.write("Our two chief Turtles are...", |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2221 ... font=("Arial", 16, "normal")) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2222 >>> turtle.penup() |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2223 >>> turtle.goto(-450,-75) |
|
abc80f8b0dfd
Make the turtle.rst doctests pass. I have a feeling there should be
R. David Murray <rdmurray@bitdance.com>
parents:
53329
diff
changeset
|
2224 >>> turtle.write(str(turtles())) |
