def clickimagegrab(self, event): x = int(self.imagegrab.canvasx(event.x)) y = int(self.imagegrab.canvasy(event.y)) tool.undopalette() newcolor = self.imagegrabtkimg.get(x,y) self.pixelgrid.palette[self.currentcolor] = newcolor self.redraw(True, True, True)
def setpalette(self, p): newp = p[:] # Keep original palette unaltered tool.undopalette() self.pixelgrid.changepalette(len(p)) self.pixelgrid.palette = newp self.currentcolor = 0 self.drawpalette() self.redraw()
def dclickpalettecanvas(self, event): i = self.getclickedpalette(event) if i < len(self.pixelgrid.palette): color=colorchooser.askcolor( initialcolor=self.pixelgrid.palette[i]) if color[0] is None: return tool.undopalette() newcolor = (int(color[0][0]),int(color[0][1]),int(color[0][2])) self.pixelgrid.palette[i] = newcolor self.drawpalette() self.redraw()
def rotatepalette(self): tool.undopalette() self.pixelgrid.palette = palette.rotate(self.pixelgrid.palette) self.drawpalette() self.redraw()
def constrainpalette(self, c): tool.undopalette() palette.constrain(self.pixelgrid.palette, c) self.drawpalette() self.redraw()