Disable base window when popup is created in Python TKinter

I have a main frame (name it a ) and a pop-up top level (name it b ). How can I make sure that the user cannot click on anything in a while b is alive?

+8
python tkinter
source share
1 answer

If you don't want to hide the root, but just make sure that 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 can withdraw() to create a root to make it invisible:

 a.withdraw() 

will leave the root alive, but only b will be visible.

If you need it, you can do

 a.deiconify() 
+18
source share

All Articles