Skip to content

Commit c6690d8

Browse files
committed
allow drawing outside bitmap boundary
1 parent 44bfdb5 commit c6690d8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

adafruit_turtle.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,19 @@ def goto(self, x1, y1=None):
200200

201201
while (not rev and x0 <= x1) or (rev and x1 <= x0):
202202
if steep:
203-
self._fg_bitmap[int(y0), int(x0)] = self._pencolor
203+
try:
204+
self._fg_bitmap[int(y0), int(x0)] = self._pencolor
205+
except IndexError:
206+
pass
204207
self._x = y0
205208
self._y = x0
206209
self._drawturtle()
207210
time.sleep(0.003)
208211
else:
209-
self._fg_bitmap[int(x0), int(y0)] = self._pencolor
212+
try:
213+
self._fg_bitmap[int(x0), int(y0)] = self._pencolor
214+
except IndexError:
215+
pass
210216
self._x = x0
211217
self._y = y0
212218
self._drawturtle()

0 commit comments

Comments
 (0)