Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Disable the underlying window when a popup is created in Python TKinter

Writer Andrew Mclaughlin

I have a master Frame (call it a), and a popup Toplevel (call it b). How do I make sure the user cannot click on anything in a while b is "alive"?

1 Answer

If you don't want to hide the root but just make sure the user can only interact with the popup, you can use grab_set() and grab_release().

b.grab_set() # when you show the popup
# do stuff ...
b.grab_release() # to return to normal

Alternatively, you could withdraw() the root to make it invisible:

a.withdraw()

will leave the root alive, but only b visible.

If you need it back, you can do

a.deiconify()
4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy