Python/tkinter Paint Program Undo Function
I tried adding an undo function in my paint program which deletes objects from the canvas (every object created is appended into a stack ) I tried it, and it works but the screen
Solution 1:
When you create your circle in the circle_end
function, you need to delete all the temporary circles you created in the circle motion function
The same goes for lines, add this to your code:
def line_end(self,event):
self.draw_zone.delete('temp_line_objects')
...
def circle_end(self,event):
self.draw_zone.delete('temp_circle_objects')
...
Also, like bryan Oakley said your code doesn't need to be as long as it is. For example you could combine set_tool_circle
, set_tool_line
and set_tool_point
into one function like this:
def set_tool(self, shape):
self.tool_option = shape
Post a Comment for "Python/tkinter Paint Program Undo Function"