def update(self, mouseclick, scrolldown, scrollup, keypressed): if self.wheel.is_clicked(self.x+self.wheel.x, self.y+self.wheel.y): r,g,b,a = self.wheel.get_color() else: for btn in range(len(self.custom_colors.grid)): if self.custom_colors.grid[btn].is_clicked(self.x+self.custom_colors.x+self.custom_colors.grid[btn].x, self.y+self.custom_colors.y+self.custom_colors.grid[btn].y, mouseclick): self.custom_selected = btn if self.custom_colors.grid[btn].color != (212,212,212): r,g,b = self.custom_colors.grid[btn].color for slider in self.sliders: slider.update(self.x+slider.x, self.y+slider.y) try: if slider.title == 'red': slider.set_value(r) if slider.title == 'green': slider.set_value(g) if slider.title == 'blue': slider.set_value(b) except: # catch 'em all. if slider.title == 'red': r = slider.get_value() if slider.title == 'green': g = slider.get_value() if slider.title == 'blue': b = slider.get_value() self.current_color = (r,g,b) self.current_color_box.fill(self.current_color) self.custom_colors.grid[self.custom_selected].color = self.current_color self.custom_colors.grid[self.custom_selected].surface.fill(self.current_color) Window.update(self, mouseclick, scrolldown, scrollup)
def update(self, mouseclick, scrolldown, scrollup, keypressed): for button in self.buttons: if button.is_clicked(self.x + button.x, self.y + button.y, mouseclick): if self.mytextbox.text.split(" ")[0] == "Cool": self.mytextbox.text += " And again." else: self.mytextbox.text = "Cool you clicked a button" self.mypane.render() self.mytextbox.render() self.mypane.scrolldown = scrolldown self.mypane.scrollup = scrollup self.mypane.update(self.x + self.mypane.x, self.y + self.mypane.y) self.inputbox.update(self.x + self.inputbox.x, self.y + self.inputbox.y, mouseclick, keypressed) Window.update(self, mouseclick, scrolldown, scrollup)