0

I am trying to add a button to close my app but the typical root.quit doesent seem to work and i dont understand why?

Here is the code piece:

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)

Ynjxsjmh
  • 28,441
  • 6
  • 34
  • 52
  • Does this answer your question? https://stackoverflow.com/questions/2307464/what-is-the-difference-between-root-destroy-and-root-quit#:~:text=The%20tkinter.Tk%20%22quit%22,then%20exits%20the%20%22mainloop%22.&text=If%20%22destroy%22%20fails%20to%20destroy,exited%20and%20Python%20locks%20up. – Tomerikoo Nov 05 '20 at 15:43

1 Answers1

0
root.quit()

only bypasses the root window but it will still be running in the background. To quit out of the window you have to use

root.destroy()
Seaver Olson
  • 450
  • 3
  • 16