Esempio n. 1
0
    def __init__(self,
                 parent,
                 width,
                 height,
                 col=None,
                 row=None,
                 outline='lightgrey',
                 fill='white'):
        EasyCanvas.__init__(self, parent, width=width, height=height)

        self.__fill = fill
        self.__outline = outline
        self.__rect = self.drawRectangle(0,
                                         0,
                                         width - 1,
                                         height - 1,
                                         outline=outline,
                                         fill=fill)

        try:
            # Try to get the on_click event handler from the parent
            self.__click_handler = lambda: parent.on_click(col, row)
        except AttributeError:
            logging.warning('Parent does not have on_click method.')
            self.__click_handler = None
Esempio n. 2
0
 def __init__(self, parent, width, height, text):
     """Sets up the canvas for drawing text."""
     EasyCanvas.__init__(self, parent, width=width, height=height)
     self.width = width
     self.height = height
     x = self.width // 2
     y = self.height // 2
     self.id = self.drawText(text, x, y)
Esempio n. 3
0
 def __init__(self, parent, width, height, letter):
     """Sets up the canvas."""
     EasyCanvas.__init__(self, parent, width=width, height=height)
     self.x = width / 2
     self.y = height / 2
     if letter == "*":
         self["background"] = "black"
     self.letterID = None
     if letter in ("P", "T"):
         self.setLetter(letter)
Esempio n. 4
0
 def __init__(self, parent, width, height, letter):
     """Sets up the canvas."""
     EasyCanvas.__init__(self, parent, width = width,
                         height = height)
     self.x = width / 2
     self.y = height / 2
     if letter == "*":
         self["background"] = "black"
     self.letterID = None
     if letter in ("P", "T"):
         self.setLetter(letter)
Esempio n. 5
0
 def __init__(self, parent, width, height, background, number,
              model):
     """Sets up the tictactoe square."""
     EasyCanvas.__init__(self, parent, width = width,
                         height = height, background = background)
     self.model = model
     self.number = number
     self.parent = parent
     self.width = width
     self.height = height
     self.letter = ""            # No letter in the square yet
     self.letterID = None
Esempio n. 6
0
 def __init__(self, parent, width, height, background):
     """Sets up the canvas."""
     EasyCanvas.__init__(self,
                         parent,
                         width=width,
                         height=height,
                         background=background)
     self.parent = parent
     self.x = width / 2
     self.y = height / 2
     if not ChessSquare.IMAGE:
         ChessSquare.IMAGE = PhotoImage(file="Queen.gif")
     self.queenExists = False
Esempio n. 7
0
    def __init__(self, parent, width, height, col=None, row=None,
                 outline='lightgrey', fill='white'):
        EasyCanvas.__init__(self, parent, width=width, height=height)

        self.__col = col
        self.__row = row
        self.__fill = fill
        self.__outline = outline
        self.__shapes = []

        self.__rect = self.drawRectangle(0, 0, width - 1, height - 1,
                                         outline=outline, fill=fill)

        self.__click_handler = None
Esempio n. 8
0
 def __init__(self, parent):
     """Background is gray."""
     EasyCanvas.__init__(self, parent, background="gray")
Esempio n. 9
0
    def __init__(self, parent, on_click=None):
        EasyCanvas.__init__(self, parent, width=50, height=50)

        self.drawOval(12, 12, 38, 38, fill='yellow')  # circle

        self.__on_click = on_click
Esempio n. 10
0
 def __init__(self, parent):
     """Sets up the canvas."""
     EasyCanvas.__init__(self, parent, background = "gray")
     self.command = "Draw"
     self.items = list()
     self.selectedItem = None
Esempio n. 11
0
 def __init__(self, parent):
     """Sets up the canvas."""
     EasyCanvas.__init__(self, parent, background="gray")
     self.command = "Draw"
     self.items = list()
     self.selectedItem = None
Esempio n. 12
0
 def __init__(self, parent):
     """Sets up the canvas."""
     EasyCanvas.__init__(self, parent, background="gray")
Esempio n. 13
0
 def __init__(self, parent):
     """Sets up the canvas."""
     EasyCanvas.__init__(self, parent, background="gray")
     self.shapeType = "Line segment"
     self.color = "black"
     self.shapes = list()
Esempio n. 14
0
 def __init__(self, parent):
     """Sets up the canvas."""
     EasyCanvas.__init__(self, parent, background = "gray")
Esempio n. 15
0
 def __init__(self, parent):
     """Background is gray."""
     EasyCanvas.__init__(self, parent, background = "gray") 
Esempio n. 16
0
 def __init__(self, parent):
     """Sets up the canvas."""
     EasyCanvas.__init__(self, parent, background = "gray")
     self.shapeType = "Line segment"
     self.color = "black"
     self.shapes = list()