例如弹出窗口。如果它的副本已经打开,我如何防止在单击它时打开它?
最原始的例子:
from tkinter import *
head = Tk()
head.geometry('800x500')
head.title('Лаунчер')
def new_window():
win = Tk()
win.geometry('300x200')
win.title('Ошибка')
win_frame = Frame(new_window)
win_frame.place(relwidth=1, relheight=1)
win.mainloop()
frame = Frame(head)
frame.place(relwidth = 1,relheight = 1)
button = Button(frame,text = 'Далее',command = new_window)
button.place(x = 350,y = 370,width = 130,height = 50)
head.mainloop()
popup_init: bool = False:is False。结果,在代码中您可以使用Andrey所说的方法,但就我而言,将窗口聚焦更容易:
或者: