@@ -226,6 +226,7 @@ def backward(self, distance):
226
226
self .forward (- distance )
227
227
bk = backward
228
228
back = backward
229
+
229
230
def right (self , angle ):
230
231
"""Turn turtle right by angle units. (Units are by default degrees,
231
232
but can be set via the degrees() and radians() functions.)
@@ -292,7 +293,6 @@ def goto(self, x1, y1=None):
292
293
if steep :
293
294
try :
294
295
self ._plot (int (y0 ), int (x0 ), self ._pencolor )
295
- # self._fg_bitmap[int(y0), int(x0)] = self._pencolor
296
296
except IndexError :
297
297
pass
298
298
self ._x = y0
@@ -302,7 +302,6 @@ def goto(self, x1, y1=None):
302
302
else :
303
303
try :
304
304
self ._plot (int (x0 ), int (y0 ), self ._pencolor )
305
- # self._fg_bitmap[int(x0), int(y0)] = self._pencolor
306
305
except IndexError :
307
306
pass
308
307
self ._x = x0
@@ -562,16 +561,12 @@ def towards(self, x1, y1=None):
562
561
raise NotImplementedError
563
562
564
563
def xcor (self ):
565
- """Not implemented
566
-
567
- Return the turtle's x coordinate."""
568
- raise NotImplementedError
564
+ """Return the turtle's x coordinate."""
565
+ return self ._x - self ._w // 2
569
566
570
567
def ycor (self ):
571
- """Not implemented
572
-
573
- Return the turtle's y coordinate."""
574
- raise NotImplementedError
568
+ """Return the turtle's y coordinate."""
569
+ return self ._h // 2 - self ._y
575
570
576
571
def heading (self ):
577
572
"""Return the turtle's current heading (value depends on the turtle
@@ -726,18 +721,10 @@ def pencolor(self, c=None):
726
721
tuple (see example). May be used as input to another color/
727
722
pencolor/fillcolor call.
728
723
729
- pencolor(colorstring)
730
- Set pencolor to colorstring, which is a Tk color specification
731
- string, such as "red", "yellow", or "#33cc8c".
732
-
733
- pencolor((r, g, b))
734
- Set pencolor to the RGB color represented by the tuple of r, g, and
735
- b. Each of r, g, and b must be in the range 0..colormode, where
736
- colormode is either 1.0 or 255 (see colormode()).
737
-
738
- pencolor(r, g, b)
739
- Set pencolor to the RGB color represented by r, g, and b. Each of r,
740
- g, and b must be in the range 0..colormode.
724
+ pencolor(colorvalue)
725
+ Set pencolor to colorvalue, which is a 24-bit integer such as 0xFF0000.
726
+ The Color class provides the available values:
727
+ WHITE, BLACK, RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE, PINK
741
728
742
729
If turtleshape is a polygon, the outline of that polygon is drawn with
743
730
the newly set pencolor.
@@ -811,10 +798,7 @@ def reset(self):
811
798
raise NotImplementedError
812
799
813
800
def clear (self ):
814
- """Delete the turtle's drawings from the screen. Do not move turtle.
815
- State and position of the turtle as well as drawings of other turtles
816
- are not affected.
817
- """
801
+ """Delete the turtle's drawings from the screen. Do not move turtle."""
818
802
for w in range (self ._w ):
819
803
for h in range (self ._h ):
820
804
self ._fg_bitmap [w , h ] = 0
@@ -1140,7 +1124,8 @@ def undobufferentries(self):
1140
1124
# Settings and special methods
1141
1125
1142
1126
def mode (self , mode = None ):
1143
- """
1127
+ """Not implemented
1128
+
1144
1129
Set turtle mode ("standard" or "logo") and perform reset.
1145
1130
If mode is not given, current mode is returned.
1146
1131
@@ -1149,17 +1134,18 @@ def mode(self, mode=None):
1149
1134
1150
1135
:param mode: one of the strings "standard" or "logo"
1151
1136
"""
1152
- if mode == "standard" :
1153
- self ._logomode = False
1154
- elif mode == "logo" :
1155
- self ._logomode = True
1156
- elif mode is None :
1157
- if self ._logomode :
1158
- return "logo"
1159
- return "standard"
1160
- else :
1161
- raise RuntimeError ("Mode must be 'logo' or 'standard!'" )
1162
- return None
1137
+ raise NotImplementedError
1138
+ # if mode == "standard":
1139
+ # self._logomode = False
1140
+ # elif mode == "logo":
1141
+ # self._logomode = True
1142
+ # elif mode is None:
1143
+ # if self._logomode:
1144
+ # return "logo"
1145
+ # return "standard"
1146
+ # else:
1147
+ # raise RuntimeError("Mode must be 'logo', 'standard!', or None")
1148
+ # return None
1163
1149
1164
1150
def colormode (self , cmode = None ):
1165
1151
"""Not implemented
0 commit comments