What can I do to prevent toplevels from appearing in 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()
It outputs like this:
CodePudding user response:
a
is the Toplevel so a.destroy()