在 Python (Qt) 应用程序中定期检查某些内容 [英] Check something at regular intervals in a Python (Qt) application

查看:42
本文介绍了在 Python (Qt) 应用程序中定期检查某些内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个使用 Python 和 Qt 作为 GUI 库的 GUI 应用程序.我想在例如之后执行某些预定的操作3 天左右(但有些更频繁,有些甚至更罕见等).

I'm writing a GUI application using Python and Qt as a GUI library. I would like to perform certain scheduled actions after e.g. 3 days or so (but some more often, some even more rare etc).

我发现了 QTimer() 应用程序,但我的理解是它只在软件运行时跟踪时间.

I have discovered the QTimer() app but my understanding is that it only tracks time while the software is running.

因此,例如,假设用户已选中每 5 天检查一次自动更新的选项.如果他在第一天运行它,一切都很好.倒计时时钟开始滴答作响.但是如果他在第 6 天第二次运行它,如何确保应用程序确实下载了更新(除了每次将日期写入某个文件并比较两者)?

So, for example, suppose a user has checked the option to check the automatic updates every 5 days. If he runs it on day one, everything is fine. The countdown clock starts ticking. But if he runs it for the second time on day 6, how to make sure the application does indeed download an update (other than writing the date every time to some file and comparing the two)?

我希望我足够清楚,如果我不明白,请告诉我,我会尽量详细说明.

I hope I'm clear enough, if I'm not, please let me know and I'll try to elaborate even better.

推荐答案

要么你的应用程序必须一直运行,eq.作为 Windows 上的小系统托盘图标,或者您需要操作系统定期运行您的应用程序版本以检查更新.

Either your app has to run all the time, eq. as a little systray icon on windows, or you need the operating system to run a version of your app regularly to check for updates.

您使用的是什么操作系统?

What operating system are you using?

在windows上看到这个答案让你的程序按预定的时间间隔运行如何以编程方式在 windows server 2008 中创建任务调度程序

edit: on windows see this answer to get your program run at scheduled intervals Programmitically how to create task scheduler in windows server 2008

这篇关于在 Python (Qt) 应用程序中定期检查某些内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆