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

Asked 1 years ago, Updated 1 years ago, 118 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.