Python Forum

Full Version: Why does [root.destroy, exit()]) fail after pyinstaller? Rpi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a small GUI app with a close button that works as expected when the app is run in Thonny, but the Exit button code fails in the binary file created with pyinstaller. Since the GUI is full screen, I must do a forced reboot to exit as the GUI is full screen.

btn = tk.Button(root, text='Exit', font=(None, 14, 'bold'), command=lambda: [root.destroy, exit()])
Any advice appreciated.
Why do you exit()? Destroying the root window will stop mainloop(). There should be nothing else going one after mainloop().
(Oct-18-2023, 01:45 PM)deanhystad Wrote: [ -> ]Why do you exit()? Destroying the root window will stop mainloop(). There should be nothing else going one after mainloop().

Thanks Dean,
So the Exit() would cause this?

I'll be back to my desk in a few hours to test it.
No idea. I don't use thonny, so I don't know how much it may alter the behavior of a Python program. If you use IDLE to write tkinter applications I'd say the way the program ran in IDLE is "somewhat representative" of how it runs in Python. How does your program work when you run it in python from the command line?
Removing the exit() solved it.
When run from terminal, there were indications that exit() was not found or invalid.
Thanks.