Program closes instantly after converting it with py2exe

62 Views Asked by At

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

There are 1 best solutions below

0
Pragmatic_Lee On BEST ANSWER

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)