当前位置:网站首页>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():
边栏推荐
- Redis source code learning (30), dictionary learning, dict.h
- Food Chem|深度学习根据成分声明准确预测食品类别和营养成分
- 【OA】Excel 文档生成器: Openpyxl 模块
- 数据的存储
- One of oscp tools: dirsearch usage Encyclopedia
- 2022中青杯C题城市交通思路分析
- Quick completion guide of manipulator (10): accessible workspace
- 【写给初发论文的人】撰写综述性科技论文常见问题
- 使用Thread类和Runnable接口实现多线程的区别
- Do you choose pandas or SQL for the top 1 of data analysis in your mind?
猜你喜欢

如何检测mysql代码运行是否出现死锁+binlog查看

Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation

web服务性能监控方案

Arduino droplet detection

leetcode:面试题 17.24. 子矩阵最大累加和(待研究)

Analysis on urban transportation ideas of 2022 Zhongqing cup C

2022中青杯C题城市交通思路分析

Simple implementation of AVL tree insertion and verification operations

Codeworks 5 questions per day (1700 average) - day 7

SQL injection -day15
随机推荐
接口数据安全保证的10种方式
When QT uses qtooltip mouse to display text, the picture of the button will also be displayed and the prompt text style will be modified
Food Chem | in depth learning accurately predicts food categories and nutritional components based on ingredient statements
Redis源码学习(31),字典学习,dict.c(一)
PHP implements lottery according to probability
MySQL data loss, analyze binlog log file
硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
Create commonly used shortcut icons at the top of the ad interface (menu bar)
2022夏每日一题(一)
Kotlin Android 环境搭建
Implementation of binary search tree
【开发软件】 tilipa开发者软件
Quick completion guide of manipulator (10): accessible workspace
Use facet to record operation log
SQL injection -day15
[record of question brushing] 2 Add two numbers
使用 TiDB Lightning 恢复 GCS 上的备份数据
自适应非欧表征广告检索系统AMCAD
二叉搜索树的实现
cuda编程