Hi When I compile my python script with py2exe, everything works well except a usless command-line dialog appears as well as my GUI. Any way to fix this? I have python 2.7 a
Using setup(windows=['Main.py'])
should remove the command line dialog and use Main.py as your console, instead.
Rename your entry point python script extension from .py
to .pyw
and regenerate your exe.
Example: python -m py2exe.build_exe -b 0 my_script.pyw
(tested with Python 3.4.3 on Windows 8.1 x64)
Example: my_script.pyw
import ctypes
MessageBox = ctypes.windll.user32.MessageBoxW
MessageBox(None, 'Hello', 'Hello Window Title', 0)
You should not see a command prompt for this GUI application.