Oct-23-2020, 12:23 PM
(This post was last modified: Oct-23-2020, 05:48 PM by deanhystad.)
Why do you care about the value of some event handle? If I was writing something like "after" I would make sure to create a unique handle for each event. In the code below I create and delete a Frame each time the mouse button is pressed/released. Each time I get a different ID for the frame. Would you want to reset the frame ID?s
from tkinter import * mouse_repeat = None window = None root = Tk() def mouse_event(event): global window if event.type == EventType.ButtonPress: window = Frame(root) print('start', window) elif window is not None: print('cancel', window) del window window = None root.bind("<Button-1>", mouse_event) root.bind("<ButtonRelease-1>", mouse_event) root.mainloop()