if path: openFile(path) savedPath = path #open file else: if replace: #If we have the replace tool selected then replace the color tools.drawGrid( ) #Redraw the grid so that we dont see the red highlight buttons = ['D', 'E', 'F', 'R', 'C'] tools.setText(buttons) tools.getGrid()[0][0].show(grid.screen, (255, 0, 0), 1, True) clicked = grid.clicked(pos) c = clicked.color replace = False for x in grid.getGrid(): for y in x: if y.color == c: y.click(grid.screen, color) elif doFill: clicked = grid.clicked(pos) if clicked.color != color: fill(clicked, grid, color, clicked.color) pygame.display.update() else: #otherwise draw the pixels accoding to the line thickness name = pygame.display.get_caption()[0]
if path: openFile(path) savedPath = path #open file else: if replace: #If we have the replace tool selected then replace the color tools.drawGrid( ) #Redraw the grid so that we dont see the red highlight buttons = ['D', 'E', 'F', 'R', 'C'] tools.setText(buttons) tools.getGrid()[0][0].show(grid.screen, (255, 0, 0), 1, True) clicked = grid.clicked(pos) c = clicked.color replace = False for x in grid.getGrid(): for y in x: if y.color == c: y.click(grid.screen, color) elif doFill: clicked = grid.clicked(pos) # 得到网格位置 if clicked.color != color: # 点击网格的颜色和选择的颜色不同 fill(clicked, grid, color, clicked.color) pygame.display.update() else: #otherwise draw the pixels accoding to the line thickness name = pygame.display.get_caption()[0]