定时器
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_())