📜  如果另一个窗口打开,则阻止窗口 tkinter - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:01.373000             🧑  作者: Mango

代码示例2
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()