@@ -213,6 +213,31 @@ useful when working with learners for whom typing is not a skill.
213213 use turtle graphics with a learner.
214214
215215
216+ Automatically begin and end filling
217+ -----------------------------------
218+
219+ Starting with Python 3.14, you can use the :func: `fill ` :term: `context manager `
220+ instead of :func: `begin_fill ` and :func: `end_fill ` to automatically begin and
221+ end fill. Here is an example::
222+
223+ with fill():
224+ for i in range(4):
225+ forward(100)
226+ right(90)
227+
228+ forward(200)
229+
230+ The code above is equivalent to::
231+
232+ begin_fill()
233+ for i in range(4):
234+ forward(100)
235+ right(90)
236+ end_fill()
237+
238+ forward(200)
239+
240+
216241Use the ``turtle `` module namespace
217242-----------------------------------
218243
@@ -351,6 +376,7 @@ Pen control
351376
352377 Filling
353378 | :func:`filling`
379+ | :func:`fill`
354380 | :func:`begin_fill`
355381 | :func:`end_fill`
356382
@@ -381,6 +407,7 @@ Using events
381407 | :func:`ondrag`
382408
383409Special Turtle methods
410+ | :func:`poly`
384411 | :func:`begin_poly`
385412 | :func:`end_poly`
386413 | :func:`get_poly`
@@ -403,6 +430,7 @@ Window control
403430 | :func:`setworldcoordinates`
404431
405432Animation control
433+ | :func:`no_animation`
406434 | :func:`delay`
407435 | :func:`tracer`
408436 | :func:`update`
@@ -1275,6 +1303,29 @@ Filling
12751303 ... else :
12761304 ... turtle.pensize(3 )
12771305
1306+ .. function :: fill()
1307+
1308+ Fill the shape drawn in the ``with turtle.fill(): `` block.
1309+
1310+ .. doctest ::
1311+ :skipif: _tkinter is None
1312+
1313+ >>> turtle.color(" black" , " red" )
1314+ >>> with turtle.fill():
1315+ ... turtle.circle(80 )
1316+
1317+ Using :func: `!fill ` is equivalent to adding the :func: `begin_fill ` before the
1318+ fill-block and :func: `end_fill ` after the fill-block:
1319+
1320+ .. doctest ::
1321+ :skipif: _tkinter is None
1322+
1323+ >>> turtle.color(" black" , " red" )
1324+ >>> turtle.begin_fill()
1325+ >>> turtle.circle(80 )
1326+ >>> turtle.end_fill()
1327+
1328+ .. versionadded :: next
12781329
12791330
12801331.. function :: begin_fill()
@@ -1648,6 +1699,23 @@ Using events
16481699Special Turtle methods
16491700----------------------
16501701
1702+
1703+ .. function :: poly()
1704+
1705+ Record the vertices of a polygon drawn in the ``with turtle.poly(): `` block.
1706+ The first and last vertices will be connected.
1707+
1708+ .. doctest ::
1709+ :skipif: _tkinter is None
1710+
1711+ >>> with turtle.poly():
1712+ ... turtle.forward(100 )
1713+ ... turtle.right(60 )
1714+ ... turtle.forward(100 )
1715+
1716+ .. versionadded :: next
1717+
1718+
16511719.. function :: begin_poly()
16521720
16531721 Start recording the vertices of a polygon. Current turtle position is first
@@ -1926,6 +1994,23 @@ Window control
19261994Animation control
19271995-----------------
19281996
1997+ .. function :: no_animation()
1998+
1999+ Temporarily disable turtle animation. The code written inside the
2000+ ``no_animation `` block will not be animated;
2001+ once the code block is exited, the drawing will appear.
2002+
2003+ .. doctest ::
2004+ :skipif: _tkinter is None
2005+
2006+ >>> with screen.no_animation():
2007+ ... for dist in range (2 , 400 , 2 ):
2008+ ... fd(dist)
2009+ ... rt(90 )
2010+
2011+ .. versionadded :: next
2012+
2013+
19292014.. function :: delay(delay=None)
19302015
19312016 :param delay: positive integer
0 commit comments