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
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)
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)
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)
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
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
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
def __init__(self, parent): """Background is gray.""" EasyCanvas.__init__(self, parent, background="gray")
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
def __init__(self, parent): """Sets up the canvas.""" EasyCanvas.__init__(self, parent, background = "gray") self.command = "Draw" self.items = list() self.selectedItem = None
def __init__(self, parent): """Sets up the canvas.""" EasyCanvas.__init__(self, parent, background="gray") self.command = "Draw" self.items = list() self.selectedItem = None
def __init__(self, parent): """Sets up the canvas.""" EasyCanvas.__init__(self, parent, background="gray")
def __init__(self, parent): """Sets up the canvas.""" EasyCanvas.__init__(self, parent, background="gray") self.shapeType = "Line segment" self.color = "black" self.shapes = list()
def __init__(self, parent): """Sets up the canvas.""" EasyCanvas.__init__(self, parent, background = "gray")
def __init__(self, parent): """Background is gray.""" EasyCanvas.__init__(self, parent, background = "gray")
def __init__(self, parent): """Sets up the canvas.""" EasyCanvas.__init__(self, parent, background = "gray") self.shapeType = "Line segment" self.color = "black" self.shapes = list()