Skip to content

Commit 31d36e3

Browse files
m-aciekStanFromIreland
authored andcommitted
Docs: simplify turtle tutorial's star example code (GH-155232)
(cherry picked from commit 7c072c1) Co-authored-by: Maciej Olko <maciej.olko@affirm.com> Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 329dab6 commit 31d36e3

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Doc/library/turtle.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ In a Python shell, import all the objects of the ``turtle`` module::
7878

7979
from turtle import *
8080

81-
If you run into a ``No module named '_tkinter'`` error, you'll have to
82-
install the :mod:`Tk interface package <tkinter>` on your system.
81+
If you run into a ``Standard library module '_tkinter' was not found`` error,
82+
you'll have to install the :mod:`Tk interface package <tkinter>` on your system.
8383

8484

8585
Basic drawing
@@ -166,14 +166,16 @@ filling can be turned on and off::
166166

167167
Next we'll create a loop::
168168

169+
start = pos()
170+
169171
while True:
170172
forward(200)
171173
left(170)
172-
if abs(pos()) < 1:
174+
if distance(start) < 1:
173175
break
174176

175-
``abs(pos()) < 1`` is a good way to know when the turtle is back at its
176-
home position.
177+
``distance(start) < 1`` is a good way to know when the turtle is back at its
178+
start position.
177179

178180
Finally, complete the filling::
179181

0 commit comments

Comments
 (0)