5858__version__ = "0.0.0-auto.0"
5959__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_turtle.git"
6060
61- class Color :
61+ class Color ( object ) :
6262 """Standard colors"""
6363 WHITE = 0xFFFFFF
6464 BLACK = 0x000000
@@ -72,6 +72,10 @@ class Color:
7272
7373 colors = (WHITE , BLACK , RED , ORANGE , YELLOW , GREEN , BLUE , PURPLE , PINK )
7474
75+ def __init__ (self ):
76+ pass
77+
78+
7579class Vec2D (tuple ):
7680 """A 2 dimensional vector class, used as a helper class
7781 for implementing turtle graphics.
@@ -86,7 +90,7 @@ class Vec2D(tuple):
8690 # |a| absolute value of a
8791 # a.rotate(angle) rotation
8892 def __init__ (self , x , y ):
89- super ().__init__ ((x , y ))
93+ super (Vec2D , self ).__init__ ((x , y ))
9094
9195 def __add__ (self , other ):
9296 return Vec2D (self [0 ] + other [0 ], self [1 ] + other [1 ])
@@ -128,7 +132,7 @@ def __repr__(self):
128132 return "(%.2f,%.2f)" % self
129133
130134
131- class turtle :
135+ class turtle ( object ) :
132136 """A Turtle that can be given commands to draw."""
133137
134138 def __init__ (self , display = board .DISPLAY ):
@@ -206,7 +210,7 @@ def forward(self, distance):
206210
207211 def backward (self , distance ):
208212 """Move the turtle backward by distance, opposite to the direction the turtle is headed.
209- Does not change the turtle’ s heading.
213+ Does not change the turtle' s heading.
210214
211215 :param distance: how far to move (integer or float)
212216 """
@@ -216,7 +220,7 @@ def backward(self, distance):
216220 back = backward
217221
218222 def degrees (self , fullcircle = 360 ):
219- """Set angle measurement units, i.e. set number of “ degrees” for a full circle.
223+ """Set angle measurement units, i.e. set number of " degrees" for a full circle.
220224 Default value is 360 degrees.
221225
222226 :param fullcircle: the number of degrees in a full circle
@@ -252,7 +256,7 @@ def goto(self, x1, y1=None):
252256 """If y1 is None, x1 must be a pair of coordinates or an (x, y) tuple
253257
254258 Move turtle to an absolute position. If the pen is down, draw line.
255- Does not change the turtle’ s orientation.
259+ Does not change the turtle' s orientation.
256260
257261 :param x1: a number or a pair of numbers
258262 :param y1: a number or None
@@ -320,7 +324,7 @@ def goto(self, x1, y1=None):
320324 setposition = goto
321325
322326 def setx (self , x ):
323- """Set the turtle’ s first coordinate to x, leave second coordinate
327+ """Set the turtle' s first coordinate to x, leave second coordinate
324328 unchanged.
325329
326330 :param x: new value of the turtle's x coordinate (a number)
@@ -329,7 +333,7 @@ def setx(self, x):
329333 self .goto (x , self .pos ()[1 ])
330334
331335 def sety (self , y ):
332- """Set the turtle’ s second coordinate to y, leave first coordinate
336+ """Set the turtle' s second coordinate to y, leave first coordinate
333337 unchanged.
334338
335339 :param y: new value of the turtle's y coordinate (a number)
@@ -355,7 +359,7 @@ def setheading(self, to_angle):
355359 seth = setheading
356360
357361 def home (self ):
358- """Move turtle to the origin – coordinates (0,0) – and set its heading to
362+ """Move turtle to the origin - coordinates (0,0) - and set its heading to
359363 its start-orientation
360364 (which depends on the mode, see mode()).
361365 """
@@ -364,7 +368,7 @@ def home(self):
364368
365369 def circle (self , radius , extent = None , steps = None ):
366370 """Draw a circle with given radius. The center is radius units left of
367- the turtle; extent – an angle – determines which part of the circle is
371+ the turtle; extent - an angle - determines which part of the circle is
368372 drawn. If extent is not given, draw the entire circle. If extent is not
369373 a full circle, one endpoint of the arc is the current pen position.
370374 Draw the arc in counterclockwise direction if radius is positive,
@@ -410,7 +414,7 @@ def clearstamp(self, stampid):
410414 raise NotImplementedError
411415
412416 def clearstamps (self , n = None ):
413- """Delete all or first/last n of turtle’ s stamps. If n is None, delete
417+ """Delete all or first/last n of turtle' s stamps. If n is None, delete
414418 all stamps, if n > 0 delete first n stamps, else if n < 0 delete last
415419 n stamps.
416420
@@ -426,17 +430,17 @@ def undo(self):
426430 raise NotImplementedError
427431
428432 def speed (self , speed = None ):
429- """Set the turtle’ s speed to an integer value in the range 0..10. If no
433+ """Set the turtle' s speed to an integer value in the range 0..10. If no
430434 argument is given, return current speed.
431435
432436 If input is a number greater than 10 or smaller than 0.5, speed is set
433437 to 0. Speedstrings are mapped to speedvalues as follows:
434438
435- “ fastest” : 0
436- “ fast” : 10
437- “ normal” : 6
438- “ slow” : 3
439- “ slowest” : 1
439+ " fastest" : 0
440+ " fast" : 10
441+ " normal" : 6
442+ " slow" : 3
443+ " slowest" : 1
440444
441445 Speeds from 1 to 10 enforce increasingly faster animation of line
442446 drawing and turtle turning.
@@ -453,12 +457,12 @@ def speed(self, speed=None):
453457 ####################
454458 # Tell turtle's state
455459 def pos (self ):
456- """Return the turtle’ s current location (x,y) (as a Vec2D vector)."""
460+ """Return the turtle' s current location (x,y) (as a Vec2D vector)."""
457461 return Vec2D (self ._x - self ._w // 2 , self ._h // 2 - self ._y )
458462 position = pos
459463
460464 def clear (self ):
461- """Delete the turtle’ s drawings from the screen. Do not move turtle.
465+ """Delete the turtle' s drawings from the screen. Do not move turtle.
462466 State and position of the turtle as well as drawings of other turtles
463467 are not affected.
464468 """
@@ -474,24 +478,24 @@ def clear(self):
474478 time .sleep (0.1 )
475479
476480 def heading (self ):
477- """Return the turtle’ s current heading (value depends on the turtle mode, see mode())."""
481+ """Return the turtle' s current heading (value depends on the turtle mode, see mode())."""
478482 return self ._heading
479483
480484 # Pen control
481485 def pendown (self ):
482- """Pull the pen down – drawing when moving."""
486+ """Pull the pen down - drawing when moving."""
483487 self ._penstate = True
484488 pd = pendown
485489 down = pendown
486490
487491 def penup (self ):
488- """Pull the pen up – no drawing when moving."""
492+ """Pull the pen up - no drawing when moving."""
489493 self ._penstate = False
490494 pu = penup
491495 up = penup
492496
493497 def isdown (self ):
494- """Return True if pen is down, False if it’ s up."""
498+ """Return True if pen is down, False if it' s up."""
495499 return self ._penstate
496500
497501 def pencolor (self , c = None ):
@@ -510,13 +514,13 @@ def pencolor(self, c=None):
510514
511515 def mode (self , mode = None ):
512516 """
513- Set turtle mode (“ standard”, “ logo” or “ world” ) and perform reset.
517+ Set turtle mode (" standard", " logo" or " world" ) and perform reset.
514518 If mode is not given, current mode is returned.
515519
516- Mode “ standard” is compatible with old turtle.
517- Mode “ logo” is compatible with most Logo turtle graphics.
520+ Mode " standard" is compatible with old turtle.
521+ Mode " logo" is compatible with most Logo turtle graphics.
518522
519- :param mode: one of the strings “ standard” or “ logo"
523+ :param mode: one of the strings " standard" or " logo"
520524 """
521525 if mode == "standard" :
522526 self ._logomode = False
0 commit comments