问题描述
我有一个小的tkinter gui,可以生成一些报告.我在其中内置了退出按钮.当我启动脚本时,该按钮可以正常工作,但是我使用cx_freeze将其转换为exe,并且除退出按钮之外,整个程序都可以正常工作.
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()
我创建了退出按钮来调用此 quits
函数,因为我读到直接调用quit可能会导致问题.任何人都知道为什么它不能作为exe工作吗?
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?
推荐答案
根据注释, quit
函数在解释器外部不起作用
As per the comments the quit
function doesn't work outside of the interpreter
def quits():
sys.exit()
可以解决问题
这篇关于移植到exe后,Python 3.6 quit()无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!