Просмотр исходного кода

Modified Point init to accept a tuple of coordinates as well, for easy testing. Should be backwards compatible.

Jayke Meijer 14 лет назад
Родитель
Сommit
c6ab9323ba
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      src/Point.py

+ 7 - 3
src/Point.py

@@ -1,4 +1,8 @@
 class Point:
-    def __init__(self, corner):
-        self.x = corner.getAttribute("x")
-        self.y = corner.getAttribute("y")
+    def __init__(self, corner = None, coordinates = None):
+        if corner != None:
+            self.x = corner.getAttribute("x")
+            self.y = corner.getAttribute("y")
+        elif coordinates != None:
+            self.x = coordinates[0]
+            self.y = coordinates[1]