Tkinter: closing a popup menu by clicking elsewhere
Peter Otten
__peter__ at web.de
Thu Feb 26 06:19:01 EST 2004
How can I close a popup menu in Tkinter by clicking elsewhere on the
toplevel window underneath?
I tried popup.grab_set() but this causes the popup to close immediately.
An alternative would be
def hidepopup(event=None):
popup.unpost()
return "break"
root.bind_all("<Button-1>", hidepopup)
but I'd then need a way to make sure that other bindings in children are not
processed or only processed after hidepopup.
Any hints welcome,
Peter
More information about the Python-list
mailing list