block window if another window is open tkinter

Solutions on MaxInterview for block window if another window is open tkinter by the best coders in the world

showing results for - "block window if another window is open tkinter"
Iker
23 May 2018
1b.grab_set() # when you show the popup
2# do stuff ...
3b.grab_release() # to return to normal
4
Yannik
07 Aug 2017
1You can also do this with an if statement:
2
3    if wind1 is not None and win1.winfo_exists():
4        pass
5
6    else:
7        wind1 = tk.Tk()
8        wind1.title('Window 1')
9
10        w1button1 = ttk.Button(wind1,text='Launch Window 2', command=startwind2)
11        w1button1.pack()
12
13        w1button2 = ttk.Button(wind1,text='Check if Window 2 exists',command=checkwind2)
14        w1button2.pack()
15
16        wind1.mainloop()