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()
-
3Just to add to your answer, I found the documentation on this (after a bit of digging) here: effbot.org/tkinterbook/tkinter-dialog-windows.htm Mar 12, 2013 at 14:56
-
4In most cases,
grab_release()
isn't necessary. Ifgrab_set()
is used on a window, control is automatically released when the window is closed. Feb 22, 2018 at 19:05 -
Is it possible to gray out the background window? (Without graying our each component individually) May 30, 2020 at 5:08
-
3Is first one (
grab_set()
) still working on latest tkinter and Python 3.7.9? These functions doesn't effects. Jun 9, 2021 at 7:18