编程语言
首页 > 编程语言> > python 笔记8

python 笔记8

作者:互联网

定时器

from PyQt5.Qt import *
import sys
class obj(QObject):
def timerEvent(self, a0: 'QTimerEvent') -> None:
print(QTimerEvent,2)


if __name__=='__main__':
app=QApplication(sys.argv)
win = QWidget()
l1 = QLabel(win)
l1.move(100,200)
obj1 =obj()
time_id = obj1.startTimer(1000)
l1.setText(str(time_id))
obj1.killTimer(time_id) #终止定时器
win.show()
sys.exit(app.exec_())
信号和槽

标签:__,obj1,python,win,l1,笔记,time,id
来源: https://www.cnblogs.com/lionmxs/p/16095610.html