When calling Python, don't let the console window open

Asked 2 years ago, Updated 2 years ago, 131 views

I have to paste the Python script (.py file) somewhere else and use it.

I made them call Python scripts periodically in other programs.

The console window (terminal) keeps popping up every time I call, which bothers me.

I'm using it on Windows.

In Stack Overflow,

There were many answers that it would be okay if you used pythonw.exe.

pythonw xxxx.There's no response even if I say py.

pythonw xxxx.There is no response even if I pyw it, and the command line just goes over.

Is there a way to prevent the window console window from opening every time a script (.py file) is called!?!?

python console terminal python3

2022-09-22 20:39

2 Answers

I checked that the console does not turn on when running pythonw.


2022-09-22 20:39

You can easily cover the console window by using the package pywin32gui, win32console.

pip install pywin32

win32gui.ShowWindow(win32console.GetConsoleWindow(), 0)

This syntax lets you mask the console window size by making it zero.


2022-09-22 20:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.