By default whenever you open an EXE generated by Pyinstaller, it will open a Console Window, regardless of whether your application is console-based or window-based. To disable this Console window (if you are building GUI applications) you must pass in an additional command line argument while compiling your Pyinstaller EXE.
To do this, all you have to do is pass the
--noconsole option as shown below.
pyinstaller --noconsole script.py
A popular usage of this is with GUI libraries like Tkinter or PyQt, where you want the User to interact with the GUI, not the console.
Only use this for production-builds however, as the console window is still very useful to have during the debugging phase. Any print statements or errors that appear will only show on the console window. You might miss out on that if you disable the console too quickly.
Here are some additional resources and guides on Pyinstaller that will help you:
- Pyinstaller Tutorial (complete guide)
- Common problems with Pyinstaller
- GUI interface for Pyinstaller (improved user experiance)
This marks the end of the “How to disable Console Window in pyinstaller EXE’s” tutorial. Any suggestions or contributions for CodersLegacy are more than welcome. Questions regarding the tutorial content can be asked in the comments section below.