block window if another window is open tkinter

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

Here is what the above code is Doing:
1. Grabbing the root window means that the popup window will be the only one that can receive events.
2. The grab_set method is called on the popup window.
3. The grab_release method is called on the popup window.
4. The grab_set method is called on the root window.
5. The grab_release method is called on the root window.