def __init__(self, display): GUI.__init__(self, display) self.onClose = None self.onSetLight = None self.lumWarm = 0 self.lumCold = 0 self.margin = 16 self.cellsX = 3 self.cellsY = 4 self.gridW = (self.width - self.margin * (self.cellsX + 1)) / self.cellsX self.gridH = (self.height - self.margin * (self.cellsY + 1)) / self.cellsY nextX = self.margin nextY = self.margin buttonQuit = Button(self, nextX, nextX, self.gridW, self.gridH, name="quit", label="Quit") nextX += self.gridW + self.margin buttonReboot = Button(self, nextX, nextY, self.gridW, self.gridH, name="reboot", label="Reboot") #nextX += self.gridW + self.margin #button3 = Button(self, nextX, nextY, self.gridW, self.gridH) nextX += self.gridW + self.margin buttonClose = Button(self, nextX, nextY, self.gridW, self.gridH, name="close", label="CLOSE") sliderWidth = self.gridW * self.cellsX + (self.cellsX-1) * self.margin nextX = self.margin nextY += self.gridH + self.margin sliderWarm = Slider(self, nextX, nextY, sliderWidth, self.gridH, name="warm", label="WARM") nextY += self.gridH + self.margin sliderCold = Slider(self, nextX, nextY, sliderWidth, self.gridH, name="cold", label="COLD") sliderWarm.onChange = self.changeLight sliderCold.onChange = self.changeLight buttonQuit.onClick = self.clickButton buttonReboot.onClick = self.clickButton #button3.onClick = self.clickButton buttonClose.onClick = self.clickButton self.addWidget(buttonQuit) self.addWidget(buttonReboot) #self.addWidget(button3) self.addWidget(buttonClose) self.addWidget(sliderWarm) self.addWidget(sliderCold) self.drawBG()
def __init__(self, view, game): self.game = game self.controller = view.controller #ugly view.controller = Controller() win = ContenedorMovil(position=(230, 50), size=(550, 530), parent=view.desktop) pass_button = Button(position = (400, 10), size=(60, 0),parent = win, text="Pass") pass_button.onClick = self.controller.pass_game win.onClick = self.controller.on_click win.onMouseDown = self.capture_first_position win.first_position = pygame.mouse.get_pos() win.board = GoBoard(parent=win, position=(0, 80), delta=(30, 40), game=game) win.board.windows = win win.board.controller = view.controller thread = threading.Thread(target=game.play) thread.start() win.onClose = self.finish_game