Skip to content

Commit 30c0988

Browse files
committed
Fixed CPython compatibility
1 parent 9f23b46 commit 30c0988

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

adafruit_turtle.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030
import gc
3131
import math
3232
import time
33-
import board
3433
import displayio
34+
try:
35+
import board
36+
except:
37+
print("[adafruit-turtle.py]: Couldn't import board module.")
3538

3639
__version__ = "0.0.0+auto.0"
3740
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_turtle.git"
@@ -80,7 +83,7 @@ def __init__(self):
8083
pass
8184

8285

83-
class Vec2D(tuple):
86+
class Vec2D():
8487
"""A 2 dimensional vector class, used as a helper class
8588
for implementing turtle graphics.
8689
May be useful for turtle graphics programs also.
@@ -94,8 +97,8 @@ class Vec2D(tuple):
9497
# k*a and a*k multiplication with scalar
9598
# |a| absolute value of a
9699
# a.rotate(angle) rotation
97-
def __init__(self, x, y):
98-
super().__init__((x, y))
100+
def __new__(cls, x, y):
101+
return (x, y)
99102

100103
def __add__(self, other):
101104
return Vec2D(self[0] + other[0], self[1] + other[1])

0 commit comments

Comments
 (0)