英文:
Program closes instantly after converting it with py2exe
问题
I have a python program with a tkinter interface (the interface has 3 buttons, one of them is an exit button) which works perfectly fine. After i convert the program with py2exe to an .exe it instantly closes after i run the exe file. When i delete the exit button, it works also fine, even as a .exe.
This is the Exit button I created:
button_exit = Button(window, text="Exit", command=sys.exit())
If anyone has a clue whats going on here i would be very grateful.
英文:
I have a python program with a tkinter interface (the interface has 3 buttons, one of them is an exit button) which works perfectly fine. After i convert the program with py2exe to an .exe it instantly closes after i run the exe file. When i delete the exit button, it works also fine, even as a .exe.
This is the Exit button I created:
button_exit = Button(window, text="Exit", command=sys.exit())
If anyone has a clue whats going on here i would be very grateful.
答案1
得分: 1
如评论中所述,将
button_exit = Button(window, text="Exit", command=sys.exit())
更改为
button_exit = Button(window, text="Exit", command=sys.exit)
英文:
As mentioned in a comment, change
button_exit = Button(window, text="Exit", command=sys.exit())
to
button_exit = Button(window, text="Exit", command=sys.exit)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论