2022-05-09 17:04:49 +02:00
|
|
|
only in patch2:
|
|
|
|
unchanged:
|
2022-05-10 21:17:52 +02:00
|
|
|
---
|
|
|
|
Doc/library/turtle.rst | 82 -------------------------------------------------
|
2022-07-14 18:01:58 +02:00
|
|
|
1 file changed, 82 deletions(-)
|
2022-05-10 21:17:52 +02:00
|
|
|
|
2022-05-09 17:04:49 +02:00
|
|
|
--- a/Doc/library/turtle.rst
|
|
|
|
+++ b/Doc/library/turtle.rst
|
|
|
|
@@ -250,7 +250,6 @@ Turtle motion
|
|
|
|
turtle is headed.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.position()
|
|
|
|
(0.00,0.00)
|
|
|
|
@@ -277,7 +276,6 @@ Turtle motion
|
|
|
|
>>> turtle.goto(0, 0)
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.position()
|
|
|
|
(0.00,0.00)
|
|
|
|
@@ -296,13 +294,11 @@ Turtle motion
|
|
|
|
orientation depends on the turtle mode, see :func:`mode`.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> turtle.setheading(22)
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.heading()
|
|
|
|
22.0
|
|
|
|
@@ -321,13 +317,11 @@ Turtle motion
|
|
|
|
orientation depends on the turtle mode, see :func:`mode`.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> turtle.setheading(22)
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.heading()
|
|
|
|
22.0
|
|
|
|
@@ -350,13 +344,11 @@ Turtle motion
|
|
|
|
not change the turtle's orientation.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> turtle.goto(0, 0)
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
2023-07-18 17:10:43 +02:00
|
|
|
>>> tp = turtle.pos()
|
|
|
|
>>> tp
|
2022-05-09 17:04:49 +02:00
|
|
|
@@ -380,13 +372,11 @@ Turtle motion
|
|
|
|
unchanged.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> turtle.goto(0, 240)
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.position()
|
|
|
|
(0.00,240.00)
|
|
|
|
@@ -402,13 +392,11 @@ Turtle motion
|
|
|
|
Set the turtle's second coordinate to *y*, leave first coordinate unchanged.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> turtle.goto(0, 40)
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.position()
|
|
|
|
(0.00,40.00)
|
|
|
|
@@ -435,7 +423,6 @@ Turtle motion
|
|
|
|
=================== ====================
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.setheading(90)
|
|
|
|
>>> turtle.heading()
|
|
|
|
@@ -448,14 +435,12 @@ Turtle motion
|
|
|
|
its start-orientation (which depends on the mode, see :func:`mode`).
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> turtle.setheading(90)
|
|
|
|
>>> turtle.goto(0, -10)
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.heading()
|
|
|
|
90.0
|
|
|
|
@@ -487,7 +472,6 @@ Turtle motion
|
|
|
|
calculated automatically. May be used to draw regular polygons.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.home()
|
|
|
|
>>> turtle.position()
|
|
|
|
@@ -516,7 +500,6 @@ Turtle motion
|
|
|
|
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.home()
|
|
|
|
>>> turtle.dot()
|
|
|
|
@@ -534,7 +517,6 @@ Turtle motion
|
|
|
|
it by calling ``clearstamp(stamp_id)``.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.color("blue")
|
|
|
|
>>> turtle.stamp()
|
|
|
|
@@ -550,7 +532,6 @@ Turtle motion
|
|
|
|
Delete stamp with given *stampid*.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.position()
|
|
|
|
(150.00,-0.00)
|
|
|
|
@@ -595,7 +576,6 @@ Turtle motion
|
|
|
|
undo actions is determined by the size of the undobuffer.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> for i in range(4):
|
|
|
|
... turtle.fd(50); turtle.lt(80)
|
|
|
|
@@ -628,7 +608,6 @@ Turtle motion
|
|
|
|
turtle turn instantly.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.speed()
|
|
|
|
3
|
|
|
|
@@ -649,7 +628,6 @@ Tell Turtle's state
|
|
|
|
Return the turtle's current location (x,y) (as a :class:`Vec2D` vector).
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.pos()
|
|
|
|
(440.00,-0.00)
|
|
|
|
@@ -665,7 +643,6 @@ Tell Turtle's state
|
|
|
|
orientation which depends on the mode - "standard"/"world" or "logo".
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.goto(10, 10)
|
|
|
|
>>> turtle.towards(0,0)
|
|
|
|
@@ -677,7 +654,6 @@ Tell Turtle's state
|
|
|
|
Return the turtle's x coordinate.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.home()
|
|
|
|
>>> turtle.left(50)
|
|
|
|
@@ -693,7 +669,6 @@ Tell Turtle's state
|
|
|
|
Return the turtle's y coordinate.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.home()
|
|
|
|
>>> turtle.left(60)
|
|
|
|
@@ -710,7 +685,6 @@ Tell Turtle's state
|
|
|
|
:func:`mode`).
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.home()
|
|
|
|
>>> turtle.left(67)
|
|
|
|
@@ -727,7 +701,6 @@ Tell Turtle's state
|
|
|
|
other turtle, in turtle step units.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.home()
|
|
|
|
>>> turtle.distance(30,40)
|
|
|
|
@@ -751,7 +724,6 @@ Settings for measurement
|
|
|
|
Default value is 360 degrees.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.home()
|
|
|
|
>>> turtle.left(90)
|
|
|
|
@@ -774,7 +746,6 @@ Settings for measurement
|
|
|
|
``degrees(2*math.pi)``.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.home()
|
|
|
|
>>> turtle.left(90)
|
|
|
|
@@ -785,7 +756,6 @@ Settings for measurement
|
|
|
|
1.5707963267948966
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> turtle.degrees(360)
|
|
|
|
@@ -821,7 +791,6 @@ Drawing state
|
|
|
|
thickness. If no argument is given, the current pensize is returned.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.pensize()
|
|
|
|
1
|
|
|
|
@@ -853,7 +822,6 @@ Drawing state
|
|
|
|
attributes in one statement.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:options: +NORMALIZE_WHITESPACE
|
|
|
|
|
|
|
|
>>> turtle.pen(fillcolor="black", pencolor="red", pensize=10)
|
|
|
|
@@ -876,7 +844,6 @@ Drawing state
|
|
|
|
Return ``True`` if pen is down, ``False`` if it's up.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.penup()
|
|
|
|
>>> turtle.isdown()
|
|
|
|
@@ -917,7 +884,6 @@ Color control
|
|
|
|
newly set pencolor.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
2023-07-18 17:10:43 +02:00
|
|
|
>>> colormode()
|
|
|
|
1.0
|
2022-05-09 17:04:49 +02:00
|
|
|
@@ -966,7 +932,6 @@ Color control
|
|
|
|
with the newly set fillcolor.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
2023-07-18 17:10:43 +02:00
|
|
|
>>> turtle.fillcolor("violet")
|
|
|
|
>>> turtle.fillcolor()
|
2022-05-09 17:04:49 +02:00
|
|
|
@@ -1005,7 +970,6 @@ Color control
|
|
|
|
with the newly set colors.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
2023-07-18 17:10:43 +02:00
|
|
|
>>> turtle.color("red", "green")
|
|
|
|
>>> turtle.color()
|
2022-05-09 17:04:49 +02:00
|
|
|
@@ -1022,7 +986,6 @@ Filling
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> turtle.home()
|
|
|
|
@@ -1032,7 +995,6 @@ Filling
|
|
|
|
Return fillstate (``True`` if filling, ``False`` else).
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
2023-07-18 17:10:43 +02:00
|
|
|
>>> turtle.begin_fill()
|
|
|
|
>>> if turtle.filling():
|
2022-05-09 17:04:49 +02:00
|
|
|
@@ -1057,7 +1019,6 @@ Filling
|
|
|
|
above may be either all yellow or have some white regions.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.color("black", "red")
|
|
|
|
>>> turtle.begin_fill()
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1074,7 +1035,6 @@ More drawing control
|
2022-05-09 17:04:49 +02:00
|
|
|
variables to the default values.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.goto(0,-22)
|
|
|
|
>>> turtle.left(100)
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1125,7 +1085,6 @@ Visibility
|
2022-05-09 17:04:49 +02:00
|
|
|
drawing observably.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.hideturtle()
|
|
|
|
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1136,7 +1095,6 @@ Visibility
|
2022-05-09 17:04:49 +02:00
|
|
|
Make the turtle visible.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.showturtle()
|
|
|
|
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1167,7 +1125,6 @@ Appearance
|
2022-05-09 17:04:49 +02:00
|
|
|
deal with shapes see Screen method :func:`register_shape`.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.shape()
|
|
|
|
'classic'
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1193,7 +1150,6 @@ Appearance
|
2022-05-09 17:04:49 +02:00
|
|
|
``resizemode("user")`` is called by :func:`shapesize` when used with arguments.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.resizemode()
|
|
|
|
'noresize'
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1217,7 +1173,6 @@ Appearance
|
2023-04-28 00:23:56 +02:00
|
|
|
of the shape's outline.
|
2022-05-09 17:04:49 +02:00
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.shapesize()
|
|
|
|
(1.0, 1.0, 1)
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1242,7 +1197,6 @@ Appearance
|
2022-05-09 17:04:49 +02:00
|
|
|
heading of the turtle are sheared.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
2023-07-18 17:10:43 +02:00
|
|
|
>>> turtle.shape("circle")
|
|
|
|
>>> turtle.shapesize(5,2)
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1259,7 +1213,6 @@ Appearance
|
2022-05-09 17:04:49 +02:00
|
|
|
change the turtle's heading (direction of movement).
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.reset()
|
|
|
|
>>> turtle.shape("circle")
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1279,7 +1232,6 @@ Appearance
|
2022-05-09 17:04:49 +02:00
|
|
|
(direction of movement).
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.reset()
|
|
|
|
>>> turtle.shape("circle")
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1305,7 +1257,6 @@ Appearance
|
2022-05-09 17:04:49 +02:00
|
|
|
turtle (its direction of movement).
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.reset()
|
|
|
|
>>> turtle.shape("circle")
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1334,7 +1285,6 @@ Appearance
|
2022-05-09 17:04:49 +02:00
|
|
|
given matrix.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle = Turtle()
|
|
|
|
>>> turtle.shape("square")
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1350,7 +1300,6 @@ Appearance
|
2022-05-09 17:04:49 +02:00
|
|
|
can be used to define a new shape or components of a compound shape.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.shape("square")
|
|
|
|
>>> turtle.shapetransform(4, -1, 0, 2)
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1375,7 +1324,6 @@ Using events
|
2022-05-09 17:04:49 +02:00
|
|
|
procedural way:
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> def turn(x, y):
|
|
|
|
... left(180)
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1396,7 +1344,6 @@ Using events
|
2022-05-09 17:04:49 +02:00
|
|
|
``None``, existing bindings are removed.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> class MyTurtle(Turtle):
|
|
|
|
... def glow(self,x,y):
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1424,7 +1371,6 @@ Using events
|
2022-05-09 17:04:49 +02:00
|
|
|
mouse-click event on that turtle.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.ondrag(turtle.goto)
|
|
|
|
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1452,7 +1398,6 @@ Special Turtle methods
|
2022-05-09 17:04:49 +02:00
|
|
|
Return the last recorded polygon.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.home()
|
|
|
|
>>> turtle.begin_poly()
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1472,7 +1417,6 @@ Special Turtle methods
|
2022-05-09 17:04:49 +02:00
|
|
|
turtle properties.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> mick = Turtle()
|
|
|
|
>>> joe = mick.clone()
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1485,7 +1429,6 @@ Special Turtle methods
|
2022-05-09 17:04:49 +02:00
|
|
|
return the "anonymous turtle":
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> pet = getturtle()
|
|
|
|
>>> pet.fd(50)
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1499,7 +1442,6 @@ Special Turtle methods
|
2022-05-09 17:04:49 +02:00
|
|
|
TurtleScreen methods can then be called for that object.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> ts = turtle.getscreen()
|
|
|
|
>>> ts
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1517,7 +1459,6 @@ Special Turtle methods
|
2022-05-09 17:04:49 +02:00
|
|
|
``None``, the undobuffer is disabled.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> turtle.setundobuffer(42)
|
|
|
|
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1527,7 +1468,6 @@ Special Turtle methods
|
2022-05-09 17:04:49 +02:00
|
|
|
Return number of entries in the undobuffer.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> while undobufferentries():
|
|
|
|
... undo()
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1550,7 +1490,6 @@ below:
|
2022-05-09 17:04:49 +02:00
|
|
|
For example:
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> s = Shape("compound")
|
|
|
|
>>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5))
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1561,7 +1500,6 @@ below:
|
2022-05-09 17:04:49 +02:00
|
|
|
3. Now add the Shape to the Screen's shapelist and use it:
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> register_shape("myshape", s)
|
|
|
|
>>> shape("myshape")
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1581,7 +1519,6 @@ Most of the examples in this section ref
|
2022-05-09 17:04:49 +02:00
|
|
|
``screen``.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> screen = Screen()
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1598,7 +1535,6 @@ Window control
|
2022-05-09 17:04:49 +02:00
|
|
|
Set or return background color of the TurtleScreen.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> screen.bgcolor("orange")
|
|
|
|
>>> screen.bgcolor()
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1690,7 +1626,6 @@ Window control
|
2022-05-09 17:04:49 +02:00
|
|
|
distorted.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> screen.reset()
|
|
|
|
>>> screen.setworldcoordinates(-50,-7.5,50,7.5)
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1701,7 +1636,6 @@ Window control
|
2022-05-09 17:04:49 +02:00
|
|
|
... left(45); fd(2) # a regular octagon
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> screen.reset()
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1723,7 +1657,6 @@ Animation control
|
2022-05-09 17:04:49 +02:00
|
|
|
Optional argument:
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> screen.delay()
|
|
|
|
10
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1745,7 +1678,6 @@ Animation control
|
2022-05-09 17:04:49 +02:00
|
|
|
:func:`delay`).
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> screen.tracer(8, 25)
|
|
|
|
>>> dist = 2
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1782,7 +1714,6 @@ Using screen events
|
2022-05-09 17:04:49 +02:00
|
|
|
must have the focus. (See method :func:`listen`.)
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> def f():
|
|
|
|
... fd(50)
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1803,7 +1734,6 @@ Using screen events
|
2022-05-09 17:04:49 +02:00
|
|
|
must have focus. (See method :func:`listen`.)
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> def f():
|
|
|
|
... fd(50)
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1828,7 +1758,6 @@ Using screen events
|
2022-05-09 17:04:49 +02:00
|
|
|
named ``turtle``:
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> screen.onclick(turtle.goto) # Subsequently clicking into the TurtleScreen will
|
|
|
|
>>> # make the turtle move to the clicked point.
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1848,7 +1777,6 @@ Using screen events
|
2022-05-09 17:04:49 +02:00
|
|
|
Install a timer that calls *fun* after *t* milliseconds.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> running = True
|
|
|
|
>>> def f():
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1930,7 +1858,6 @@ Settings and special methods
|
2022-05-09 17:04:49 +02:00
|
|
|
============ ========================= ===================
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> mode("logo") # resets turtle heading to north
|
|
|
|
>>> mode()
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1945,7 +1872,6 @@ Settings and special methods
|
|
|
|
values of color triples have to be in the range 0..*cmode*.
|
2022-05-09 17:04:49 +02:00
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> screen.colormode(1)
|
|
|
|
>>> turtle.pencolor(240, 160, 80)
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1966,7 +1892,6 @@ Settings and special methods
|
2022-05-09 17:04:49 +02:00
|
|
|
do with a Tkinter Canvas.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> cv = screen.getcanvas()
|
|
|
|
>>> cv
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -1978,7 +1903,6 @@ Settings and special methods
|
2022-05-09 17:04:49 +02:00
|
|
|
Return a list of names of all currently available turtle shapes.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> screen.getshapes()
|
|
|
|
['arrow', 'blank', 'circle', ..., 'turtle']
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -2002,7 +1926,6 @@ Settings and special methods
|
2022-05-09 17:04:49 +02:00
|
|
|
coordinates: Install the corresponding polygon shape.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> screen.register_shape("triangle", ((5,-3), (0,5), (-5,-3)))
|
|
|
|
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -2018,7 +1941,6 @@ Settings and special methods
|
2022-05-09 17:04:49 +02:00
|
|
|
Return the list of turtles on the screen.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> for turtle in screen.turtles():
|
|
|
|
... turtle.color("red")
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -2080,7 +2002,6 @@ Methods specific to Screen, not inherite
|
2022-05-09 17:04:49 +02:00
|
|
|
center window vertically
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> screen.setup (width=200, height=200, startx=0, starty=0)
|
|
|
|
>>> # sets window to 200x200 pixels, in upper left of screen
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -2096,7 +2017,6 @@ Methods specific to Screen, not inherite
|
2022-05-09 17:04:49 +02:00
|
|
|
Set title of turtle window to *titlestring*.
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> screen.title("Welcome to the turtle zoo!")
|
|
|
|
|
2022-05-10 21:17:52 +02:00
|
|
|
@@ -2167,7 +2087,6 @@ Public classes
|
2022-05-09 17:04:49 +02:00
|
|
|
Example:
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
|
|
|
|
>>> poly = ((0,0),(10,-5),(0,10),(-10,-5))
|
|
|
|
>>> s = Shape("compound")
|
2023-04-28 00:23:56 +02:00
|
|
|
@@ -2518,7 +2437,6 @@ Changes since Python 3.0
|
2022-05-09 17:04:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
.. doctest::
|
|
|
|
- :skipif: _tkinter is None
|
|
|
|
:hide:
|
|
|
|
|
|
|
|
>>> for turtle in turtles():
|