0

I created a game using python in PyCharm. I used pyinstaller to create an executable and when it runs a first python window opens then the pygame window opens. The python window is completely blank and where all things would go if I used a print command. I am curious as to whether there is a way to remove this window as it does not do anything. Thank you for your help in advance.

Here is a screenshot of the to windows: The top-most window is the one that I would like to remove.

rdobbs05
  • 3
  • 2

1 Answers1

0

By renaming your .py file (for example 'main.py') to .pyw and then converting it to an executable the same way you did it last time, you could avoid opening the console window.

Python scripts (files with the extension .py) will be executed by python.exe by default. This executable opens a terminal, which stays open even if the program uses a GUI. If you do not want this to happen, use the extension .pyw which will cause the script to be executed by pythonw.exe by default (both executables are located in the top-level of your Python installation directory). This suppresses the terminal window on startup.

From the python documentation.

Marsolgen
  • 199
  • 1
  • 8