forked from pool/python312
Matej Cepl
cde4f6d8a6
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python312?expand=0&rev=10
646 lines
15 KiB
Diff
646 lines
15 KiB
Diff
only in patch2:
|
|
unchanged:
|
|
---
|
|
Doc/library/turtle.rst | 81 -------------------------------------------------
|
|
1 file changed, 81 deletions(-)
|
|
|
|
--- a/Doc/library/turtle.rst
|
|
+++ b/Doc/library/turtle.rst
|
|
@@ -251,7 +251,6 @@ Turtle motion
|
|
turtle is headed.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.position()
|
|
(0.00,0.00)
|
|
@@ -278,7 +277,6 @@ Turtle motion
|
|
>>> turtle.goto(0, 0)
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.position()
|
|
(0.00,0.00)
|
|
@@ -297,13 +295,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
|
|
@@ -322,13 +318,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
|
|
@@ -351,13 +345,11 @@ Turtle motion
|
|
not change the turtle's orientation.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
:hide:
|
|
|
|
>>> turtle.goto(0, 0)
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> tp = turtle.pos()
|
|
>>> tp
|
|
@@ -419,13 +411,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)
|
|
@@ -441,13 +431,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)
|
|
@@ -474,7 +462,6 @@ Turtle motion
|
|
=================== ====================
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.setheading(90)
|
|
>>> turtle.heading()
|
|
@@ -487,14 +474,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
|
|
@@ -526,7 +511,6 @@ Turtle motion
|
|
calculated automatically. May be used to draw regular polygons.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.home()
|
|
>>> turtle.position()
|
|
@@ -555,7 +539,6 @@ Turtle motion
|
|
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.home()
|
|
>>> turtle.dot()
|
|
@@ -573,7 +556,6 @@ Turtle motion
|
|
it by calling ``clearstamp(stamp_id)``.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.color("blue")
|
|
>>> stamp_id = turtle.stamp()
|
|
@@ -588,7 +570,6 @@ Turtle motion
|
|
Delete stamp with given *stampid*.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.position()
|
|
(150.00,-0.00)
|
|
@@ -626,7 +607,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)
|
|
@@ -659,7 +639,6 @@ Turtle motion
|
|
turtle turn instantly.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.speed()
|
|
3
|
|
@@ -680,7 +659,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)
|
|
@@ -696,7 +674,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)
|
|
@@ -708,7 +685,6 @@ Tell Turtle's state
|
|
Return the turtle's x coordinate.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.home()
|
|
>>> turtle.left(50)
|
|
@@ -724,7 +700,6 @@ Tell Turtle's state
|
|
Return the turtle's y coordinate.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.home()
|
|
>>> turtle.left(60)
|
|
@@ -741,7 +716,6 @@ Tell Turtle's state
|
|
:func:`mode`).
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.home()
|
|
>>> turtle.left(67)
|
|
@@ -758,7 +732,6 @@ Tell Turtle's state
|
|
other turtle, in turtle step units.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.home()
|
|
>>> turtle.distance(30,40)
|
|
@@ -782,7 +755,6 @@ Settings for measurement
|
|
Default value is 360 degrees.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.home()
|
|
>>> turtle.left(90)
|
|
@@ -805,7 +777,6 @@ Settings for measurement
|
|
``degrees(2*math.pi)``.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.home()
|
|
>>> turtle.left(90)
|
|
@@ -816,7 +787,6 @@ Settings for measurement
|
|
1.5707963267948966
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
:hide:
|
|
|
|
>>> turtle.degrees(360)
|
|
@@ -852,7 +822,6 @@ Drawing state
|
|
thickness. If no argument is given, the current pensize is returned.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.pensize()
|
|
1
|
|
@@ -884,7 +853,6 @@ Drawing state
|
|
attributes in one statement.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
:options: +NORMALIZE_WHITESPACE
|
|
|
|
>>> turtle.pen(fillcolor="black", pencolor="red", pensize=10)
|
|
@@ -907,7 +875,6 @@ Drawing state
|
|
Return ``True`` if pen is down, ``False`` if it's up.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.penup()
|
|
>>> turtle.isdown()
|
|
@@ -948,7 +915,6 @@ Color control
|
|
newly set pencolor.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> colormode()
|
|
1.0
|
|
@@ -997,7 +963,6 @@ Color control
|
|
with the newly set fillcolor.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.fillcolor("violet")
|
|
>>> turtle.fillcolor()
|
|
@@ -1036,7 +1001,6 @@ Color control
|
|
with the newly set colors.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.color("red", "green")
|
|
>>> turtle.color()
|
|
@@ -1053,7 +1017,6 @@ Filling
|
|
~~~~~~~
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
:hide:
|
|
|
|
>>> turtle.home()
|
|
@@ -1063,7 +1026,6 @@ Filling
|
|
Return fillstate (``True`` if filling, ``False`` else).
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.begin_fill()
|
|
>>> if turtle.filling():
|
|
@@ -1088,7 +1050,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()
|
|
@@ -1105,7 +1066,6 @@ More drawing control
|
|
variables to the default values.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.goto(0,-22)
|
|
>>> turtle.left(100)
|
|
@@ -1156,7 +1116,6 @@ Visibility
|
|
drawing observably.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.hideturtle()
|
|
|
|
@@ -1167,7 +1126,6 @@ Visibility
|
|
Make the turtle visible.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.showturtle()
|
|
|
|
@@ -1198,7 +1156,6 @@ Appearance
|
|
deal with shapes see Screen method :func:`register_shape`.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.shape()
|
|
'classic'
|
|
@@ -1224,7 +1181,6 @@ Appearance
|
|
``resizemode("user")`` is called by :func:`shapesize` when used with arguments.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.resizemode()
|
|
'noresize'
|
|
@@ -1248,7 +1204,6 @@ Appearance
|
|
of the shape's outline.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.shapesize()
|
|
(1.0, 1.0, 1)
|
|
@@ -1273,7 +1228,6 @@ Appearance
|
|
heading of the turtle are sheared.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.shape("circle")
|
|
>>> turtle.shapesize(5,2)
|
|
@@ -1290,7 +1244,6 @@ Appearance
|
|
change the turtle's heading (direction of movement).
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.reset()
|
|
>>> turtle.shape("circle")
|
|
@@ -1336,7 +1289,6 @@ Appearance
|
|
turtle (its direction of movement).
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.reset()
|
|
>>> turtle.shape("circle")
|
|
@@ -1365,7 +1317,6 @@ Appearance
|
|
given matrix.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle = Turtle()
|
|
>>> turtle.shape("square")
|
|
@@ -1381,7 +1332,6 @@ Appearance
|
|
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)
|
|
@@ -1406,7 +1356,6 @@ Using events
|
|
procedural way:
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> def turn(x, y):
|
|
... left(180)
|
|
@@ -1427,7 +1376,6 @@ Using events
|
|
``None``, existing bindings are removed.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> class MyTurtle(Turtle):
|
|
... def glow(self,x,y):
|
|
@@ -1455,7 +1403,6 @@ Using events
|
|
mouse-click event on that turtle.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.ondrag(turtle.goto)
|
|
|
|
@@ -1483,7 +1430,6 @@ Special Turtle methods
|
|
Return the last recorded polygon.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.home()
|
|
>>> turtle.begin_poly()
|
|
@@ -1503,7 +1449,6 @@ Special Turtle methods
|
|
turtle properties.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> mick = Turtle()
|
|
>>> joe = mick.clone()
|
|
@@ -1516,7 +1461,6 @@ Special Turtle methods
|
|
return the "anonymous turtle":
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> pet = getturtle()
|
|
>>> pet.fd(50)
|
|
@@ -1530,7 +1474,6 @@ Special Turtle methods
|
|
TurtleScreen methods can then be called for that object.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> ts = turtle.getscreen()
|
|
>>> ts
|
|
@@ -1548,7 +1491,6 @@ Special Turtle methods
|
|
``None``, the undobuffer is disabled.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> turtle.setundobuffer(42)
|
|
|
|
@@ -1558,7 +1500,6 @@ Special Turtle methods
|
|
Return number of entries in the undobuffer.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> while undobufferentries():
|
|
... undo()
|
|
@@ -1581,7 +1522,6 @@ below:
|
|
For example:
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> s = Shape("compound")
|
|
>>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5))
|
|
@@ -1592,7 +1532,6 @@ below:
|
|
3. Now add the Shape to the Screen's shapelist and use it:
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> register_shape("myshape", s)
|
|
>>> shape("myshape")
|
|
@@ -1612,7 +1551,6 @@ Most of the examples in this section ref
|
|
``screen``.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
:hide:
|
|
|
|
>>> screen = Screen()
|
|
@@ -1629,7 +1567,6 @@ Window control
|
|
Set or return background color of the TurtleScreen.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> screen.bgcolor("orange")
|
|
>>> screen.bgcolor()
|
|
@@ -1721,7 +1658,6 @@ Window control
|
|
distorted.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> screen.reset()
|
|
>>> screen.setworldcoordinates(-50,-7.5,50,7.5)
|
|
@@ -1732,7 +1668,6 @@ Window control
|
|
... left(45); fd(2) # a regular octagon
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
:hide:
|
|
|
|
>>> screen.reset()
|
|
@@ -1754,7 +1689,6 @@ Animation control
|
|
Optional argument:
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> screen.delay()
|
|
10
|
|
@@ -1776,7 +1710,6 @@ Animation control
|
|
:func:`delay`).
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> screen.tracer(8, 25)
|
|
>>> dist = 2
|
|
@@ -1813,7 +1746,6 @@ Using screen events
|
|
must have the focus. (See method :func:`listen`.)
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> def f():
|
|
... fd(50)
|
|
@@ -1834,7 +1766,6 @@ Using screen events
|
|
must have focus. (See method :func:`listen`.)
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> def f():
|
|
... fd(50)
|
|
@@ -1859,7 +1790,6 @@ Using screen events
|
|
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.
|
|
@@ -1879,7 +1809,6 @@ Using screen events
|
|
Install a timer that calls *fun* after *t* milliseconds.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> running = True
|
|
>>> def f():
|
|
@@ -1961,7 +1890,6 @@ Settings and special methods
|
|
============ ========================= ===================
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> mode("logo") # resets turtle heading to north
|
|
>>> mode()
|
|
@@ -1976,7 +1904,6 @@ Settings and special methods
|
|
values of color triples have to be in the range 0..*cmode*.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> screen.colormode(1)
|
|
>>> turtle.pencolor(240, 160, 80)
|
|
@@ -1997,7 +1924,6 @@ Settings and special methods
|
|
do with a Tkinter Canvas.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> cv = screen.getcanvas()
|
|
>>> cv
|
|
@@ -2009,7 +1935,6 @@ Settings and special methods
|
|
Return a list of names of all currently available turtle shapes.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> screen.getshapes()
|
|
['arrow', 'blank', 'circle', ..., 'turtle']
|
|
@@ -2033,7 +1958,6 @@ Settings and special methods
|
|
coordinates: Install the corresponding polygon shape.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> screen.register_shape("triangle", ((5,-3), (0,5), (-5,-3)))
|
|
|
|
@@ -2049,7 +1973,6 @@ Settings and special methods
|
|
Return the list of turtles on the screen.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> for turtle in screen.turtles():
|
|
... turtle.color("red")
|
|
@@ -2111,7 +2034,6 @@ Methods specific to Screen, not inherite
|
|
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
|
|
@@ -2127,7 +2049,6 @@ Methods specific to Screen, not inherite
|
|
Set title of turtle window to *titlestring*.
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> screen.title("Welcome to the turtle zoo!")
|
|
|
|
@@ -2198,7 +2119,6 @@ Public classes
|
|
Example:
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
|
|
>>> poly = ((0,0),(10,-5),(0,10),(-10,-5))
|
|
>>> s = Shape("compound")
|
|
@@ -2549,7 +2469,6 @@ Changes since Python 3.0
|
|
|
|
|
|
.. doctest::
|
|
- :skipif: _tkinter is None
|
|
:hide:
|
|
|
|
>>> for turtle in turtles():
|