我有这个描述鼠标移动的代码
import sys
import math
import time
from datetime import datetime
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from toolz.itertoolz import second
class Frame:
def __init__(self, position, time):
self.position = position
self.time = time
def speed(self, frame):
d = distance(*self.position, *frame.position)
time_delta = abs(frame.time - self.time)
return d / time_delta
if __name__ == '__main__':
app = QApplication(sys.argv)
last_frame = get_current_frame()
我想要计算鼠标移动时的时间。 我怎么能设置一个定时器,每当鼠标移动一秒钟时,它会做+1秒?