📅  最后修改于: 2022-03-11 14:46:01.373000             🧑  作者: Mango
You can also do this with an if statement:
if wind1 is not None and win1.winfo_exists():
pass
else:
wind1 = tk.Tk()
wind1.title('Window 1')
w1button1 = ttk.Button(wind1,text='Launch Window 2', command=startwind2)
w1button1.pack()
w1button2 = ttk.Button(wind1,text='Check if Window 2 exists',command=checkwind2)
w1button2.pack()
wind1.mainloop()