0

I'm making a game in Tkinter and I've converted it to an exe using pyinstaller for distribution. When my program is closed, It keeps running in the task manager as a background process, stopping the file from being moved or deleted. I've tried in many ways to fix this such as sys.exit() and taskill to try and counter this problem but none work.

Reverting what I've tried, this is my exit code:

def rootOnClose():
    root.destroy()
    sys.exit(1)

From CoolClouds suggestion, all my buttons in root window:

inventorybutton = Button(root, text="Inventory", fg="White", bg="Black", width="11", command=inventory)
inventorybutton.grid(column="0", row="0")

marketbutton = Button(root, text="Market", fg="White", bg="Black", width="11", command=market)
marketbutton.grid(column="0", row="1")

upgradesbutton = Button(root, text="Upgrades", fg="White", bg="Black", width="11", command=upgrades)
upgradesbutton.grid(column="0", row="2")

leftfruitbutton = Button(root, text="<", command=switchleft, state=DISABLED)
leftfruitbutton.place(x="100", y="285")

rightfruitbutton = Button(root, text=">", command=switchright)
rightfruitbutton.place(x="287", y="285")

clickerbutton = Button(root, text="Clicker Button", image=clickerphoto, fg="Black", command=clicked)
clickerbutton.place(x="100", y="75")

musicselectbutton = Button(root, text="Music", command=musicselect, bg="Black", fg="White", width="11")
musicselectbutton.grid(row="4", column="0")

savebutton = Button(root, text="Save", fg="White", bg="Black", width="11", command=save)
savebutton.grid(row="5", column="0")

loadbutton = Button(root, text="Load", fg="White", bg="Black", width="11", command=load)
loadbutton.grid(row="6", column="0")

munchconvertbutton = Button(root, text="Convert Munch", fg="White", bg="Black", width="11", command=convertmunch)
munchconvertbutton.grid(row="7", column="0")

calendarbutton = Button(root, text="Calendar", fg="White", bg="Black", width="11", command=calendar)
calendarbutton.grid(row="8", column="0")

with root being my Tkinter window.

Solution: Stopping the exe completely with (preferrably) no console and in the quickest way possible. Thanks

0 Answers0