Skip to content

CPython compatibility #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions adafruit_turtle.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
import time
import displayio

try:
import board
except NotImplementedError:
print("[adafruit-turtle.py]: Couldn't import board module.")

__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_turtle.git"

Expand Down Expand Up @@ -98,11 +93,11 @@ class Vec2D:
# k*a and a*k multiplication with scalar
# |a| absolute value of a
# a.rotate(angle) rotation
def __new__(cls, x, y):
return (x, y)
def __init__(self, x, y):
self.values = (x, y)

def __getitem__(self, index):
return getattr(self, index)
return self.values[index]

def __add__(self, other):
return Vec2D(self[0] + other[0], self[1] + other[1])
Expand Down Expand Up @@ -154,6 +149,9 @@ def __init__(self, display=None, scale=1):
self._display = display
else:
try:
# pylint: disable=import-outside-toplevel
import board

self._display = board.DISPLAY
except AttributeError as err:
raise RuntimeError(
Expand Down Expand Up @@ -404,6 +402,7 @@ def goto(self, x1, y1=None):

setpos = goto
setposition = goto

# pylint:enable=too-many-branches,too-many-statements

def setx(self, x):
Expand Down