如何防止 Tkinter 中出现多个顶层?

What to prevent multiple toplevels from appearing in Tkinter?

如何防止 Tkinter 中出现顶层?

from tkinter import *
import os

root = Tk()

def top_level():
    a=Toplevel()
    l=Label(a,text="yeni")
    l.pack()

    def yeni():
        root.destroy()
        os.startfile("a.pyw")
    
        top_level()
    
    bt1= Button(a,  text="Top Level",command= yeni)
    bt1.pack()
    a.mainloop()

bt= Button(root,  text="Top Level",command= top_level)
bt.pack()

root.mainloop()

它的输出是这样的:

a 是顶层所以 a.destroy()