简体   繁体   English

我可以将 PySide2 应用程序作为 Windows 后台进程运行吗

[英]Can I run an PySide2 application as a Windows Background Process

I want that the app accept an input from the user and then go into the background as a Windows Background Process.我希望应用程序接受来自用户的输入,然后作为 Windows 后台进程进入后台。 So, is that even possible?那么,这甚至可能吗? If yes then how?如果是,那么如何?

I am using Python 3.6.8 and the PySide2 gui framework我正在使用 Python 3.6.8 和 PySide2 gui 框架

You can run an external background process with pythonw.exe .您可以使用pythonw.exe运行外部后台进程。 You will have to run it by using subprocess or via Qprocess in pyside.你将不得不通过运行该subprocess或通过QProcess中的pyside。

import subprocess
subprocess.run(["pythonw.exe", "path/to/your/program"])

This will run your program in the background with no visible process or way to interact with it.这将在后台运行您的程序,没有可见的进程或与之交互的方式。 You can only terminate it with a system monitor您只能使用系统监视器终止它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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