diff --git a/src/gui/boardview.py b/src/gui/boardview.py --- a/src/gui/boardview.py +++ b/src/gui/boardview.py @@ -9,7 +9,7 @@ class BoardView(ResizableCanvas): self.configure(width=360,height=360,background="#ffcc00") - self._padding=18 + self._padding=24 self._cellWidth=(self._width-2*self._padding)/18 self._cellHeight=(self._height-2*self._padding)/18 @@ -24,10 +24,11 @@ class BoardView(ResizableCanvas): def _drawGrid(self): padding=self._padding for i in range(19): - self.create_line(padding,18*i+padding,self._width-padding,18*i+padding,tags="row",fill="#000000") # rows - self.create_line(18*i+padding,padding,18*i+padding,self._height-padding,tags="col",fill="#000000") # cols + self.create_line(padding,self._cellHeight*i+padding,self._width-padding,self._cellHeight*i+padding,tags="row",fill="#000000") # rows + self.create_line(self._cellWidth*i+padding,padding,self._cellWidth*i+padding,self._height-padding,tags="col",fill="#000000") # cols self._drawStars() + self._drawCoordinates() def _drawStars(self): radius=2 @@ -38,6 +39,17 @@ class BoardView(ResizableCanvas): y=r*self._cellWidth+self._padding self.create_oval(x-radius,y-radius,x+radius,y+radius,tags="star",fill='#000000') + def _drawCoordinates(self): + for i in range(19): + letters="ABCDEFGHJKLMNOPQRST" + textWidth=12 + # cols + self.create_text(self._padding+i*self._cellWidth,self._padding-textWidth,text=letters[i],tags="coords") + self.create_text(self._padding+i*self._cellWidth,self._height-self._padding+textWidth,text=letters[i],tags="coords") + # rows + self.create_text(self._padding-textWidth,self._padding+i*self._cellHeight,text=str(19-i),tags="coords") + self.create_text(self._width-self._padding+textWidth,self._padding+i*self._cellHeight,text=str(19-i),tags="coords") + ## Draws a stone at provided coordinates. # # For an unknown color draws nothing and returns False.