Reputation: 3
I'm having a problem with pyinstaller when I use exit
, an error appears and the program cannot run. When I use quit
or sys.exit()
, the program does not run. If I leave all of these out and use the X button, the threads keep running in the task manager. What function should I use to fix this?
Needed Code
def exitgame():
sys.exit()
main = Tk()
main.title("Fruit Clicker")
main.geometry("400x350+300+100")
Button(main, text="Play", command=rootopen).pack()
Button(main, text="Quit Game", command=exitgame).pack()
Thanks in advance
Upvotes: 0
Views: 48
Reputation: 58
Instead of writing function to quit a application, you can close application directly without a function, just replace "command=exitgame" to "command=main.destroy" for 'Quit game button'.
Sample code-
from tkinter import *
from tkinter.ttk import *
main = Tk()
main.title("Fruit Clicker")
main.geometry("400x350+300+100")
Button(main, text="Quit Game", command=main.destroy).pack()
mainloop()
Upvotes: 2