Fixed test errors by implementing __getitem__ method for Vec2D
This commit is contained in:
parent
0161017036
commit
cf9a11aac8
1 changed files with 4 additions and 1 deletions
|
|
@ -35,7 +35,7 @@ import displayio
|
|||
|
||||
try:
|
||||
import board
|
||||
except:
|
||||
except NotImplementedError:
|
||||
print("[adafruit-turtle.py]: Couldn't import board module.")
|
||||
|
||||
__version__ = "0.0.0+auto.0"
|
||||
|
|
@ -102,6 +102,9 @@ class Vec2D:
|
|||
def __new__(cls, x, y):
|
||||
return (x, y)
|
||||
|
||||
def __getitem__(self, index):
|
||||
return getattr(self, index)
|
||||
|
||||
def __add__(self, other):
|
||||
return Vec2D(self[0] + other[0], self[1] + other[1])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue