当前位置:网站首页>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():
边栏推荐
- 【OA】Excel 文档生成器: Openpyxl 模块
- Antd Comment 递归循环评论
- POJ培训计划2253_Frogger(最短/floyd)
- Redis source code learning (31), dictionary learning, dict.c (1)
- Summer 2022 daily question 1 (1)
- CUDA Programming
- QT opens a file and uses QFileDialog to obtain the file name, content, etc
- Quick completion guide of manipulator (10): accessible workspace
- What is the experience of maintaining Wanxing open source vector database
- 红米k40s root玩机笔记
猜你喜欢
数据的存储
Force buckle ----- path sum III
Redis configuration and optimization of NoSQL
【knife-4j 快速搭建swagger】
opencv第三方库
Machine learning notes - bird species classification using machine learning
Collection of idea gradle Lombok errors
Operational amplifier application summary 1
Class constant pool and runtime constant pool
MySQL data loss, analyze binlog log file
随机推荐
【写给初发论文的人】撰写综述性科技论文常见问题
[development software] tilipa Developer Software
golang 根据生日计算星座和属相
复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
Kotlin Android environment construction
学习使用js把两个对象合并成一个对象的方法Object.assign()
Preprocessing - interpolation
Food Chem | in depth learning accurately predicts food categories and nutritional components based on ingredient statements
2022 middle school Youth Cup mathematical modeling question B fertility policy research ideas under the background of open three children
Allow public connections to local Ruby on Rails Development Server
map和set的实现
Triple half circle progress bar, you can use it directly
力扣------路径总和 III
太方便了,钉钉上就可完成代码发布审批啦!
The most complete learning rate adjustment strategy in history LR_ scheduler
接口数据安全保证的10种方式
Do you choose pandas or SQL for the top 1 of data analysis in your mind?
Adaptive non European advertising retrieval system amcad
golang 压缩和解压zip文件
史上最全MongoDB之Mongo Shell使用