Python 为什么root.quit不关闭程序?

Python 为什么root.quit不关闭程序?,python,tkinter,Python,Tkinter,我正在尝试添加一个按钮来关闭我的应用程序,但是典型的root.quit似乎可以工作,我不明白为什么 以下是代码片段: root = Tk() root.title("Fahrkartenautomat") root.iconbitmap("E:\pyth\ka.ico") wk = Label(root, text="Willkommen!") ksb = Button(root, text="Kurzstraeke&quo

我正在尝试添加一个按钮来关闭我的应用程序,但是典型的root.quit似乎可以工作,我不明白为什么

以下是代码片段:

root = Tk()
root.title("Fahrkartenautomat")
root.iconbitmap("E:\pyth\ka.ico")
wk = Label(root, text="Willkommen!")

ksb = Button(root, text="Kurzstraeke", state=NORMAL, command=ksc(KS,s))
tkb = Button(root, text="Tageskarte", state=NORMAL, command=tkc(TG,s))
mkb = Button(root, text="Monatskarte", state=NORMAL, command=mkc(MK,s))
jkb = Button(root, text="Jahreskarte", state=NORMAL, command=jkc(JK,s))
wt= Button(root, text="Weiter", fg="#00AA00", state=NORMAL)
exb= Button(root, text="Schliessen", fg="#FF0000", bg="#000000", state=NORMAL, command=root.quit)

仅绕过根窗口,但它仍将在后台运行。要退出窗口,您必须使用

root.destroy()

这回答了你的问题吗。
root.destroy()