Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hide the console window in a PyQt app running on Windows?

Surely this is possible? I have been hunting through PyQt tutorials and documentation but cannot find the answer to it. Probably I just need to phrase my search query differently.

[Edit]

Thanks PEZ for the answer - more details including use of the .pyw extension in Python Programming on Win32 chapter 20

like image 387
danio Avatar asked Jan 21 '09 17:01

danio


People also ask

How do I open a second window in pyqt5?

In Qt any widget without a parent is a window. This means, to show a new window you just need to create a new instance of a widget. This can be any widget type (technically any subclass of QWidget ) including another QMainWindow if you prefer. There is no restriction on the number of QMainWindow instances you can have.


2 Answers

I think you should be able to run your app with pythonw.exe.

like image 185
PEZ Avatar answered Sep 23 '22 16:09

PEZ


An easy way to do this is to give your script a .pyw extension instead of the usual .py.

This has the same effect as PEZ's answer (runs the script using pythonw.exe).

like image 25
Kiv Avatar answered Sep 21 '22 16:09

Kiv