如何获得当前打开的/以前的Tkinter窗口的名称?

时间:2019-12-26 08:47:49

标签: python tkinter

from tkinter import *


def screenTwo():
    screen2 = Tk()
    screen2.geometry('500x400')

    button2 = Button(screen2, text = 'Go back!')
    button2.place(x=200,y=50)

    screen2.mainloop()


screen = Tk()
screen.geometry('500x400')

button = Button(screen, text = 'Click me', command=screenTwo)
button.place(x=200,y=50)



screen.mainloop()

我想用.destroy()关闭窗口,但是我不想直接引用该窗口,因为当我开始处理一堆窗口时,它将变得很烦人。 是否有命令/功能可在其中获得当前或上一个窗口?

0 个答案:

没有答案