@@ -905,7 +905,7 @@ def addcomponent(self, poly, fill, outline=None):
905905 >>> poly = ((0,0),(10,-5),(0,10),(-10,-5))
906906 >>> s = Shape("compound")
907907 >>> s.addcomponent(poly, "red", "blue")
908- ## # .. add more components and then use register_shape()
908+ >>> # .. add more components and then use register_shape()
909909 """
910910 if self ._type != "compound" :
911911 raise TurtleGraphicsError ("Cannot add component to %s Shape"
@@ -1003,7 +1003,7 @@ def clear(self):
10031003 no backgroundimage, no eventbindings and tracing on.
10041004
10051005 Example (for a TurtleScreen instance named screen):
1006- screen.clear()
1006+ >>> screen.clear()
10071007
10081008 Note: this method is not available as function.
10091009 """
@@ -1077,8 +1077,8 @@ def setworldcoordinates(self, llx, lly, urx, ury):
10771077 Example (for a TurtleScreen instance named screen):
10781078 >>> screen.setworldcoordinates(-10,-0.5,50,1.5)
10791079 >>> for _ in range(36):
1080- left(10)
1081- forward(0.5)
1080+ ... left(10)
1081+ ... forward(0.5)
10821082 """
10831083 if self .mode () != "world" :
10841084 self .mode ("world" )
@@ -1182,7 +1182,7 @@ def colormode(self, cmode=None):
11821182 >>> screen.colormode()
11831183 1.0
11841184 >>> screen.colormode(255)
1185- >>> turtle. pencolor(240,160,80)
1185+ >>> pencolor(240,160,80)
11861186 """
11871187 if cmode is None :
11881188 return self ._colormode
@@ -1250,9 +1250,9 @@ def tracer(self, n=None, delay=None):
12501250 >>> screen.tracer(8, 25)
12511251 >>> dist = 2
12521252 >>> for i in range(200):
1253- fd(dist)
1254- rt(90)
1255- dist += 2
1253+ ... fd(dist)
1254+ ... rt(90)
1255+ ... dist += 2
12561256 """
12571257 if n is None :
12581258 return self ._tracing
@@ -1279,7 +1279,7 @@ def delay(self, delay=None):
12791279 self ._delayvalue = int (delay )
12801280
12811281 def _incrementudc (self ):
1282- "Increment upadate counter." ""
1282+ """ Increment upadate counter."""
12831283 if not TurtleScreen ._RUNNING :
12841284 TurtleScreen ._RUNNNING = True
12851285 raise Terminator
@@ -1347,16 +1347,12 @@ def onclick(self, fun, btn=1, add=None):
13471347 clicked point on the canvas.
13481348 num -- the number of the mouse-button, defaults to 1
13491349
1350- Example (for a TurtleScreen instance named screen
1351- and a Turtle instance named turtle):
1350+ Example (for a TurtleScreen instance named screen)
13521351
1353- >>> screen.onclick(turtle.goto)
1354-
1355- ### Subsequently clicking into the TurtleScreen will
1356- ### make the turtle move to the clicked point.
1352+ >>> screen.onclick(goto)
1353+ >>> # Subsequently clicking into the TurtleScreen will
1354+ >>> # make the turtle move to the clicked point.
13571355 >>> screen.onclick(None)
1358-
1359- ### event-binding will be removed
13601356 """
13611357 self ._onscreenclick (fun , btn , add )
13621358
@@ -1370,20 +1366,18 @@ def onkey(self, fun, key):
13701366 In order to be able to register key-events, TurtleScreen
13711367 must have focus. (See method listen.)
13721368
1373- Example (for a TurtleScreen instance named screen
1374- and a Turtle instance named turtle):
1369+ Example (for a TurtleScreen instance named screen):
13751370
13761371 >>> def f():
1377- fd(50)
1378- lt(60)
1379-
1380-
1372+ ... fd(50)
1373+ ... lt(60)
1374+ ...
13811375 >>> screen.onkey(f, "Up")
13821376 >>> screen.listen()
13831377
1384- ### Subsequently the turtle can be moved by
1385- ### repeatedly pressing the up-arrow key,
1386- ### consequently drawing a hexagon
1378+ Subsequently the turtle can be moved by repeatedly pressing
1379+ the up-arrow key, consequently drawing a hexagon
1380+
13871381 """
13881382 if fun is None :
13891383 if key in self ._keys :
@@ -1407,16 +1401,15 @@ def onkeypress(self, fun, key=None):
14071401 and a Turtle instance named turtle):
14081402
14091403 >>> def f():
1410- fd(50)
1411-
1412-
1413- >>> screen.onkey (f, "Up")
1404+ ... fd(50)
1405+ ... lt(60)
1406+ ...
1407+ >>> screen.onkeypress (f, "Up")
14141408 >>> screen.listen()
14151409
1416- ### Subsequently the turtle can be moved by
1417- ### repeatedly pressing the up-arrow key,
1418- ### or by keeping pressed the up-arrow key.
1419- ### consequently drawing a hexagon.
1410+ Subsequently the turtle can be moved by repeatedly pressing
1411+ the up-arrow key, or by keeping pressed the up-arrow key.
1412+ consequently drawing a hexagon.
14201413 """
14211414 if fun is None :
14221415 if key in self ._keys :
@@ -1448,12 +1441,12 @@ def ontimer(self, fun, t=0):
14481441
14491442 >>> running = True
14501443 >>> def f():
1451- if running:
1452- fd(50)
1453- lt(60)
1454- screen.ontimer(f, 250)
1455-
1456- >>> f() ### makes the turtle marching around
1444+ ... if running:
1445+ ... fd(50)
1446+ ... lt(60)
1447+ ... screen.ontimer(f, 250)
1448+ ...
1449+ >>> f() # makes the turtle marching around
14571450 >>> running = False
14581451 """
14591452 self ._ontimer (fun , t )
@@ -1497,7 +1490,7 @@ def screensize(self, canvwidth=None, canvheight=None, bg=None):
14971490
14981491 Example (for a Turtle instance named turtle):
14991492 >>> turtle.screensize(2000,1500)
1500- ### e. g. to search for an erroneously escaped turtle ;-)
1493+ >>> # e.g. to search for an erroneously escaped turtle ;-)
15011494 """
15021495 return self ._resize (canvwidth , canvheight , bg )
15031496
@@ -2085,7 +2078,7 @@ def pensize(self, width=None):
20852078 Example (for a Turtle instance named turtle):
20862079 >>> turtle.pensize()
20872080 1
2088- turtle.pensize(10) # from here on lines of width 10 are drawn
2081+ >>> turtle.pensize(10) # from here on lines of width 10 are drawn
20892082 """
20902083 if width is None :
20912084 return self ._pensize
@@ -2560,7 +2553,7 @@ def reset(self):
25602553 """Delete the turtle's drawings and restore its default values.
25612554
25622555 No argument.
2563- ,
2556+
25642557 Delete the turtle's drawings from the screen, re-center the turtle
25652558 and set variables to the default values.
25662559
@@ -2607,7 +2600,7 @@ def undobufferentries(self):
26072600
26082601 Example (for a Turtle instance named turtle):
26092602 >>> while undobufferentries():
2610- undo()
2603+ ... undo()
26112604 """
26122605 if self .undobuffer is None :
26132606 return 0
@@ -2683,9 +2676,9 @@ def _tracer(self, flag=None, delay=None):
26832676 >>> turtle.tracer(8, 25)
26842677 >>> dist = 2
26852678 >>> for i in range(200):
2686- turtle.fd(dist)
2687- turtle.rt(90)
2688- dist += 2
2679+ ... turtle.fd(dist)
2680+ ... turtle.rt(90)
2681+ ... dist += 2
26892682 """
26902683 return self .screen .tracer (flag , delay )
26912684
@@ -2883,7 +2876,6 @@ def tiltangle(self, angle=None):
28832876 >>> turtle.shapesize(5,2)
28842877 >>> turtle.tilt(45)
28852878 >>> turtle.tiltangle()
2886- >>>
28872879 """
28882880 if angle is None :
28892881 tilt = - self ._tilt * (180.0 / math .pi ) * self ._angleOrient
@@ -2928,7 +2920,7 @@ def shapetransform(self, t11=None, t12=None, t21=None, t22=None):
29282920 >>> turtle.shapesize(4,2)
29292921 >>> turtle.shearfactor(-0.5)
29302922 >>> turtle.shapetransform()
2931- >>> (4.0, -1.0, -0.0, 2.0)
2923+ (4.0, -1.0, -0.0, 2.0)
29322924 """
29332925 if t11 is t12 is t21 is t22 is None :
29342926 return self ._shapetrafo
@@ -3126,7 +3118,7 @@ def clearstamps(self, n=None):
31263118
31273119 Example (for a Turtle instance named turtle):
31283120 >>> for i in range(8):
3129- turtle.stamp(); turtle.fd(30)
3121+ ... turtle.stamp(); turtle.fd(30)
31303122 ...
31313123 >>> turtle.clearstamps(2)
31323124 >>> turtle.clearstamps(-2)
@@ -3302,9 +3294,9 @@ def filling(self):
33023294 Example (for a Turtle instance named turtle):
33033295 >>> turtle.begin_fill()
33043296 >>> if turtle.filling():
3305- turtle.pensize(5)
3306- else:
3307- turtle.pensize(3)
3297+ ... turtle.pensize(5)
3298+ ... else:
3299+ ... turtle.pensize(3)
33083300 """
33093301 return isinstance (self ._fillpath , list )
33103302
@@ -3534,9 +3526,9 @@ def onclick(self, fun, btn=1, add=None):
35343526 Example for the anonymous turtle, i. e. the procedural way:
35353527
35363528 >>> def turn(x, y):
3537- left(360)
3538-
3539- >>> onclick(turn) # Now clicking into the turtle will turn it.
3529+ ... left(360)
3530+ ...
3531+ >>> onclick(turn) # Now clicking into the turtle will turn it.
35403532 >>> onclick(None) # event-binding will be removed
35413533 """
35423534 self .screen ._onclick (self .turtle ._item , fun , btn , add )
@@ -3552,16 +3544,17 @@ def onrelease(self, fun, btn=1, add=None):
35523544
35533545 Example (for a MyTurtle instance named joe):
35543546 >>> class MyTurtle(Turtle):
3555- def glow(self,x,y):
3556- self.fillcolor("red")
3557- def unglow(self,x,y):
3558- self.fillcolor("")
3559-
3547+ ... def glow(self,x,y):
3548+ ... self.fillcolor("red")
3549+ ... def unglow(self,x,y):
3550+ ... self.fillcolor("")
3551+ ...
35603552 >>> joe = MyTurtle()
35613553 >>> joe.onclick(joe.glow)
35623554 >>> joe.onrelease(joe.unglow)
3563- ### clicking on joe turns fillcolor red,
3564- ### unclicking turns it to transparent.
3555+
3556+ Clicking on joe turns fillcolor red, unclicking turns it to
3557+ transparent.
35653558 """
35663559 self .screen ._onrelease (self .turtle ._item , fun , btn , add )
35673560 self ._update ()
@@ -3580,9 +3573,9 @@ def ondrag(self, fun, btn=1, add=None):
35803573 Example (for a Turtle instance named turtle):
35813574 >>> turtle.ondrag(turtle.goto)
35823575
3583- ### Subsequently clicking and dragging a Turtle will
3584- ### move it across the screen thereby producing handdrawings
3585- ### (if pen is down).
3576+ Subsequently clicking and dragging a Turtle will move it
3577+ across the screen thereby producing handdrawings (if pen is
3578+ down).
35863579 """
35873580 self .screen ._ondrag (self .turtle ._item , fun , btn , add )
35883581
@@ -3630,10 +3623,11 @@ def undo(self):
36303623
36313624 Example (for a Turtle instance named turtle):
36323625 >>> for i in range(4):
3633- turtle.fd(50); turtle.lt(80)
3634-
3626+ ... turtle.fd(50); turtle.lt(80)
3627+ ...
36353628 >>> for i in range(8):
3636- turtle.undo()
3629+ ... turtle.undo()
3630+ ...
36373631 """
36383632 if self .undobuffer is None :
36393633 return
0 commit comments