diff --git a/src/gui.py b/src/gui.py --- a/src/gui.py +++ b/src/gui.py @@ -3,11 +3,14 @@ from PIL import ImageTk import PIL import math from epoint import * +from corners import * +from grid import * class Application(tk.Frame): def __init__(self, master=None): - self.corners=[] + self.corners=Corners() + self.boardGrid=None tk.Frame.__init__(self, master) self.grid(column=0,row=0) @@ -31,35 +34,16 @@ class Application(tk.Frame): ## Stores a grid corner located at x,y coordinates. def addCorner(self,x,y): - a=EPoint(x,y) - for i,c in enumerate(self.corners): # move an improperly placed point - if a.dist(c)<20: - self.corners[i]=a - # print(self.corners) - self.redrawImgView() - return - - if len(self.corners)<4: # add a new corner - self.corners.append(a) - # print(self.corners) - self.redrawImgView() - - if len(self.corners)<4: return - - index,minDist=0,float('inf') # replace the corner closest to the clicked point - for i,c in enumerate(self.corners): - if a.dist(c)