简体   繁体   中英

How to make a python file run in the background when minimized?

I made a Python program that I do NOT want to turn into .exe or anything else.
However since the program needs python.exe to run, it runs python.exe openly.
I want to know if I can add a piece of code to the program I made so that it runs in the background.
BTW, I do not want to run through cmd.I want it to be a background process automatically.
Basically, I want to add some code into my program so that as soon as it is clicked upon, it runs in background.

I found out the way to do this easily: I just renamed my file.py into file.pyw
Now, it runs without a console. Basically I typed this in the cmd:
ren file.py file.pyw

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM