当前位置:网站首页>Pyqt5 out of focus monitoring no operation timer
Pyqt5 out of focus monitoring no operation timer
2022-07-07 04:09:00 【AI vision netqi】
pyqt5 Defocus No operation monitoring
The following is from :
How to capture PyQt5 QMainWindow Lose focus -python Black hole network
timer Can be updated ui.
class MainUi(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.init_ui()
self.setFocus()
QtWidgets.qApp.focusChanged.connect(self.on_focusChanged)
@QtCore.pyqtSlot("QWidget*", "QWidget*")
def on_focusChanged(self, old, now):
if now == None:
print(f"\nwindow lost focus: {self.isActiveWindow()}",time.strftime('%Y-%m-%d %H:%M:%S'))
# self.setWindowState(QtCore.Qt.WindowMinimized)
self.loss_start = time.time() # Record the start time
self.timer.start(1000*5) # Set the timer interval and start ,1 second
def lose_focus(self):
if not self.isActiveWindow():
边栏推荐
- web服务性能监控方案
- 【刷题记录】2. 两数相加
- AVL树插入操作与验证操作的简单实现
- 杭州电 3711 Binary Number
- Termux set up the computer to connect to the mobile phone. (knock the command quickly), mobile phone termux port 8022
- Enter the rough outline of the URL question (continuously updated)
- [development software] tilipa Developer Software
- PHP implements lottery according to probability
- 机器学习笔记 - 使用机器学习进行鸟类物种分类
- [record of question brushing] 2 Add two numbers
猜你喜欢
It's too convenient. You can complete the code release and approval by nailing it!
2022夏每日一题(一)
How to detect whether the MySQL code runs deadlock +binlog view
Kotlin Android 环境搭建
Implementation of map and set
Ggplot facet detail adjustment summary
10 ways of interface data security assurance
Summer 2022 daily question 1 (1)
史上最全MongoDB之部署篇
ABAP dynamic inner table grouping cycle
随机推荐
Some common software related
SQL injection -day15
如何检测mysql代码运行是否出现死锁+binlog查看
HW notes (II)
2022夏每日一题(一)
杭州电 3711 Binary Number
PHP implements lottery according to probability
Use facet to record operation log
红米k40s root玩机笔记
Unity3D在一建筑GL材料可以改变颜色和显示样本
Docker部署Mysql8的实现步骤
Restore backup data on GCS with tidb lightning
Web service performance monitoring scheme
[hcie TAC] question 3
三重半圆环进度条,直接拿去就能用
Allow public connections to local Ruby on Rails Development Server
map和set的实现
[dpdk] dpdk sample source code analysis III: dpdk-l3fwd_ 001
cuda编程
【knife-4j 快速搭建swagger】