I have recently written a fairly simple program for my grandfather using Python with GUI from Tkinter, and it works beautifully for what he will be using it for. However, there is, of course, the ugly console output window. I have successfully gotten rid of it by simply changing the extension of the file from .py to .pyw. When I freeze it using PyInstaller, it reappears again! Is there any way for me to fix this?
Thanks in advance.
We can hide or avoid the console by specifying pyinstaller --oneline filename --windowed command.
Simply save it with a . pyw extension. This will prevent the console window from opening.
Bundling to One Folder When you apply PyInstaller to myscript.py the default result is a single folder named myscript . This folder contains all your script's dependencies, and an executable file also named myscript ( myscript.exe in Windows).
The most common reason a PyInstaller package fails is that PyInstaller failed to bundle a required file. Such missing files fall into a few categories: Hidden or missing imports: Sometimes PyInstaller can't detect the import of a package or library, typically because it is imported dynamically.
If you want to hide the console window, here is the documentation: This is how you use the --noconsole
option
python pyinstaller.py --noconsole yourscript.py
If you need help using pyinstaller to get to the point where you need to use the --noconsole
option here is a simple tutorial for getting there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With