Hung Truong Hung Truong - 1 year ago 149
Python Question

Tkinter Toplevel : Destroy window when not focused

I have a

widget that I want to destroy whenever the user clicks out of the window. I tried finding solutions on the Internet, but there seems to be no article discussing about this topic.

How can I achieve this. Thanks for any help !

Answer Source

You can try something like that : fen is your toplevel

fen.bind("<FocusOut>", fen.quit)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download