Skip to content

Commit 284e767

Browse files
StanFromIrelandm-aciekwillingc
committed
Apply review suggestions
Co-authored-by: Maciej Olko <maciej.olko@affirm.com> Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
1 parent eff9d13 commit 284e767

2 files changed

Lines changed: 63 additions & 42 deletions

File tree

‎Doc/library/turtle.rst‎

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,14 @@ Move and draw
356356
:param y: a number or ``None``
357357
:param fill_gap: a boolean
358358

359-
Instantly move the turtle to an absolute position. Unlike :func:`goto`, no
360-
line is drawn. If *x* or *y* is not given, that coordinate is kept as it
361-
is. The turtle's heading does not change.
359+
Teleport, or instantly move, the turtle to an absolute position. Unlike
360+
:func:`goto`, no line is drawn. If *x* or *y* is not given, that coordinate
361+
is kept as it is. The turtle's heading does not change.
362362

363363
If the turtle is filling a shape, the shape drawn so far is finished and
364-
filled before the jump, and filling starts again at the new position. Pass
365-
``fill_gap=True`` to keep filling one shape instead. The jump then counts
366-
as an edge of the shape, as it would with :func:`goto`.
364+
filled before teleporting, and filling starts again at the new position.
365+
Pass ``fill_gap=True`` to keep filling one shape instead. The teleport then
366+
counts as an edge of the shape, as it would with :func:`goto`.
367367

368368
.. doctest::
369369
:skipif: _tkinter is None
@@ -626,7 +626,7 @@ Move and draw
626626
Return or set the turtle's speed. If *speed* is not given, return the
627627
current speed. Otherwise set the turtle's speed to an integer from 0 to 10.
628628
If *speed* is a number greater than 10 or smaller than 0.5, the speed is
629-
set to 0. A speed string is mapped to a speed value as follows:
629+
set to 0. You can also use these names instead of numbers:
630630

631631
* "fastest": 0
632632
* "fast": 10
@@ -816,24 +816,24 @@ Drawing state
816816
pd()
817817
down()
818818

819-
Pull the pen down. The turtle draws a line when it moves.
819+
Lower the pen. The turtle draws a line when it moves.
820820

821821

822822
.. function:: penup()
823823
pu()
824824
up()
825825

826-
Pull the pen up. The turtle does not draw when it moves.
826+
Lift the pen. The turtle does not draw when it moves.
827827

828828

829829
.. function:: pensize(width=None)
830830
width(width=None)
831831

832832
:param width: a positive number or ``None``
833833

834-
Set the line thickness to *width* or return it. If *width* is not given,
835-
return the current pensize. If resizemode is set to "auto" and the turtle
836-
shape is a polygon, that polygon is drawn with the same line thickness.
834+
Return or set the line thickness. If *width* is not given, return the
835+
current pensize. If resizemode is set to "auto" and the turtle shape is a
836+
polygon, that polygon is drawn with the same line thickness.
837837

838838
.. doctest::
839839
:skipif: _tkinter is None
@@ -1201,11 +1201,11 @@ Appearance
12011201

12021202
:param name: a string or ``None``
12031203

1204-
Set the turtle shape to the shape with the given *name*. If *name* is not
1205-
given, return the name of the current shape. The shape must exist in the
1204+
Set the turtle shape to the named shape. If *name* is not given, return the
1205+
name of the current shape. The shape must exist in the
12061206
:class:`TurtleScreen`'s shape dictionary. Initially there are the following
1207-
polygon shapes: "arrow", "turtle", "circle", "square", "triangle" and
1208-
"classic". To add shapes, see the :class:`Screen` method :func:`register_shape`.
1207+
shapes: "arrow", "turtle", "circle", "square", "triangle" and "classic". To
1208+
add shapes, see the :class:`Screen` method :func:`register_shape`.
12091209

12101210
.. doctest::
12111211
:skipif: _tkinter is None
@@ -1253,10 +1253,16 @@ Appearance
12531253
Return or set the turtle's stretch factors and outline width. If no
12541254
arguments are given, return the current values. Otherwise set resizemode to
12551255
"user", so that the turtle is displayed stretched according to its stretch
1256-
factors. *stretch_wid* is the stretch factor perpendicular to the turtle's
1257-
heading and *stretch_len* the stretch factor in the direction of its
1258-
heading. If only *stretch_wid* is given, *stretch_len* is set to the same
1259-
value. *outline* is the width of the shape's outline.
1256+
factors:
1257+
1258+
- *stretch_wid*: the stretch factor perpendicular to the turtle's heading
1259+
- *stretch_len*: the stretch factor in the direction of the turtle's
1260+
heading
1261+
- *outline*: the width of the shape's outline
1262+
1263+
For example, ``shapesize(2, 1)`` makes the turtle twice as wide without
1264+
changing its length. If only *stretch_wid* is given, *stretch_len* is set to
1265+
the same value.
12601266

12611267
.. doctest::
12621268
:skipif: _tkinter is None
@@ -1520,8 +1526,8 @@ Special Turtle methods
15201526

15211527
Return the Turtle object itself.
15221528

1523-
Generally used as a function, to get the anonymous turtle used by the
1524-
module-level functions:
1529+
Call ``getturtle()`` to get the turtle used by functions such as
1530+
:func:`forward` and :func:`left`:
15251531

15261532
.. doctest::
15271533
:skipif: _tkinter is None
@@ -2295,6 +2301,8 @@ How-to guides
22952301
This section covers some typical turtle use-cases and approaches.
22962302

22972303

2304+
.. _automatically-begin-and-end-filling:
2305+
22982306
How to automatically begin and end filling
22992307
------------------------------------------
23002308

@@ -2321,6 +2329,7 @@ The code above is equivalent to::
23212329

23222330

23232331
.. _compoundshapes:
2332+
.. _compound-shapes:
23242333

23252334
How to use compound shapes
23262335
--------------------------
@@ -2353,6 +2362,8 @@ below:
23532362
>>> shape("myshape")
23542363

23552364

2365+
.. _use-the-turtle-module-namespace:
2366+
23562367
How to use the ``turtle`` module namespace
23572368
------------------------------------------
23582369

@@ -2368,6 +2379,8 @@ The solution is to use ``import turtle`` - ``fd()`` becomes
23682379
as t`` instead.)
23692380

23702381

2382+
.. _use-turtle-graphics-in-a-script:
2383+
23712384
How to use turtle graphics in a script
23722385
--------------------------------------
23732386

@@ -2393,6 +2406,8 @@ will not exit until it is terminated, for example by closing the turtle
23932406
graphics window.
23942407

23952408

2409+
.. _use-object-oriented-turtle-graphics:
2410+
23962411
How to use object-oriented turtle graphics
23972412
------------------------------------------
23982413

‎Lib/turtle.py‎

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,7 @@ def resizemode(self, rmode=None):
21542154
self.pen(resizemode=rmode)
21552155

21562156
def pensize(self, width=None):
2157-
"""Set the line thickness to width or return it.
2157+
"""Return or set the line thickness.
21582158
21592159
Aliases: pensize | width
21602160
@@ -2176,7 +2176,7 @@ def pensize(self, width=None):
21762176

21772177

21782178
def penup(self):
2179-
"""Pull the pen up.
2179+
"""Lift the pen.
21802180
21812181
Aliases: penup | pu | up
21822182
@@ -2187,7 +2187,7 @@ def penup(self):
21872187
self.pen(pendown=False)
21882188

21892189
def pendown(self):
2190-
"""Pull the pen down.
2190+
"""Lower the pen.
21912191
21922192
Aliases: pendown | pd | down
21932193
@@ -2215,8 +2215,8 @@ def speed(self, speed=None):
22152215
22162216
If speed is not given, return the current speed. Otherwise set the
22172217
turtle's speed to an integer from 0 to 10. If speed is a number
2218-
greater than 10 or smaller than 0.5, the speed is set to 0. A
2219-
speed string is mapped to a speed value as follows:
2218+
greater than 10 or smaller than 0.5, the speed is set to 0. You
2219+
can also use these names instead of numbers:
22202220
22212221
"fastest": 0
22222222
"fast": 10
@@ -2775,15 +2775,15 @@ def _cc(self, args):
27752775
return "#%02x%02x%02x" % (r, g, b)
27762776

27772777
def teleport(self, x=None, y=None, *, fill_gap: bool = False) -> None:
2778-
"""Instantly move the turtle to an absolute position.
2778+
"""Teleport, or instantly move, the turtle to an absolute position.
27792779
27802780
Unlike goto(), no line is drawn. If x or y is not given, that
27812781
coordinate is kept as it is. The turtle's heading does not change.
27822782
27832783
If the turtle is filling a shape, the shape drawn so far is
2784-
finished and filled before the jump, and filling starts again at
2785-
the new position. Pass fill_gap=True to keep filling one shape
2786-
instead. The jump then counts as an edge of the shape, as it
2784+
finished and filled before teleporting, and filling starts again
2785+
at the new position. Pass fill_gap=True to keep filling one shape
2786+
instead. The teleport then counts as an edge of the shape, as it
27872787
would with goto().
27882788
27892789
Arguments:
@@ -2859,13 +2859,13 @@ def clone(self):
28592859
return q
28602860

28612861
def shape(self, name=None):
2862-
"""Set the turtle shape to the shape with the given name.
2862+
"""Set the turtle shape to the named shape.
28632863
28642864
If name is not given, return the name of the current shape. The
28652865
shape must exist in the TurtleScreen's shape dictionary. Initially
2866-
there are the following polygon shapes: "arrow", "turtle",
2867-
"circle", "square", "triangle" and "classic". To add shapes,
2868-
see the Screen method register_shape().
2866+
there are the following shapes: "arrow", "turtle", "circle",
2867+
"square", "triangle" and "classic". To add shapes, see the Screen
2868+
method register_shape().
28692869
28702870
Argument:
28712871
name -- a string or None
@@ -2891,11 +2891,17 @@ def shapesize(self, stretch_wid=None, stretch_len=None, outline=None):
28912891
28922892
If no arguments are given, return the current values. Otherwise
28932893
set resizemode to "user", so that the turtle is displayed
2894-
stretched according to its stretch factors. stretch_wid is the
2895-
stretch factor perpendicular to the turtle's heading and
2896-
stretch_len the stretch factor in the direction of its heading.
2897-
If only stretch_wid is given, stretch_len is set to the same
2898-
value. outline is the width of the shape's outline.
2894+
stretched according to its stretch factors:
2895+
2896+
- stretch_wid: the stretch factor perpendicular to the turtle's
2897+
heading
2898+
- stretch_len: the stretch factor in the direction of the
2899+
turtle's heading
2900+
- outline: the width of the shape's outline
2901+
2902+
For example, shapesize(2, 1) makes the turtle twice as wide
2903+
without changing its length. If only stretch_wid is given,
2904+
stretch_len is set to the same value.
28992905
29002906
Arguments:
29012907
stretch_wid -- a positive number or None
@@ -3606,8 +3612,8 @@ def getturtle(self):
36063612
36073613
Aliases: getturtle | getpen
36083614
3609-
Generally used as a function, to get the anonymous turtle used by
3610-
the module-level functions.
3615+
Call getturtle() to get the turtle used by functions such as
3616+
forward() and left().
36113617
36123618
Example:
36133619
>>> pet = getturtle()

0 commit comments

Comments
 (0)