简体   繁体   English

如何在后台运行我的应用程序 python

[英]How can I run my application in the background python

I want to know that is it possible that i can run my application in background even if I click the cancel button.我想知道即使单击取消按钮,我是否可以在后台运行我的应用程序。 I design the application in pyqt5 using python let's look at example in android if we want that this app will run in the background after i close the app for that we use different kind of methods one method is Runnable and the code example is below我使用pythonpyqt5中设计应用程序,让我们看看android中的示例,如果我们希望此应用程序在我关闭应用程序后在后台运行,我们使用不同类型的方法运行下面的Runnable代码

Handler mainHandler = new Handler(getMainLooper());
Runnable myRunnable = new Runnable() {
@Override 
public void run() {....} // This is the work to do on the background
};
mainHandler.post(myRunnable);

I want to do like this If I close the application the app must run in the background and the icon goes to show hidden icon but in python.我想这样做如果我关闭应用程序,应用程序必须在后台运行,并且图标会show hidden icon ,但在 python 中。

In general when you want to run a python application on the background you use the module "daemon" that makes the process as a daemon or you can use the operator & at the end on unix.通常,当您想在后台运行 python 应用程序时,您可以使用模块“守护程序”,使进程成为守护程序,或者您可以在 unix 的末尾使用运算符 &。 Have a look to the module daemon that may help you,看看可能对你有帮助的模块守护进程,

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

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