Python 3.6 quit() not working after porting to exe

若如初见. 提交于 2021-02-05 11:39:24

问题


I have a small tkinter gui that generates some reports. I built a quit button into it. The button works perfectly when I launch the script, but I converted it to an exe with cx_freeze and the entire program is working except the quit button.

def quits():
    quit()

I created the quit button to call this quits function because I read that just calling quit directly could cause problems. Anyone have any idea why this is not working as an exe?


回答1:


As per the comments the quit function doesn't work outside of the interpreter

def quits():
    sys.exit()

That does the trick



来源:https://stackoverflow.com/questions/44787430/python-3-6-quit-not-working-after-porting-to-exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!