Open rob51852 opened 2 years ago
Replace time.sleep() in mouse/init.py
def play(events, speed_factor=1.0, include_clicks=True, include_moves=True, include_wheel=True): last_time = None for event in events: if speed_factor > 0 and last_time is not None: _time.sleep((event.time - last_time) / speed_factor) last_time = event.time
with the function below
def delayMicrosecond(t): start,end=0,0 start=_time.time() t=(t-3)/1000000 while end-start<t: end=_time.time()
Because the common delay function of python is time.sleep, and the minimum delay precision is 0.001 seconds, that is, time.sleep (0.001) delay is 1 millisecond. Under the Windows 10 operating system, the measured delay of the logic analyzer is 13 millisecond. My CPU is Intel i5 10400F, and the expected delay has changed from 1 millisecond to 13 millisecond.
Replace time.sleep() in mouse/init.py
def play(events, speed_factor=1.0, include_clicks=True, include_moves=True, include_wheel=True): last_time = None for event in events: if speed_factor > 0 and last_time is not None: _time.sleep((event.time - last_time) / speed_factor) last_time = event.time
with the function below
def delayMicrosecond(t): start,end=0,0 start=_time.time() t=(t-3)/1000000 while end-start<t: end=_time.time()
Because the common delay function of python is time.sleep, and the minimum delay precision is 0.001 seconds, that is, time.sleep (0.001) delay is 1 millisecond. Under the Windows 10 operating system, the measured delay of the logic analyzer is 13 millisecond. My CPU is Intel i5 10400F, and the expected delay has changed from 1 millisecond to 13 millisecond.
i replaced _time.sleep in play function to delayMicrosecond function you made but now its too fast that i cant even see it moving.. like every recorded movement finishes in less than 0.1 secs. any idea how to solve?
for event in events:
if speed_factor > 0 and last_time is not None:
delayMicrosecond((event.time - last_time) / speed_factor)
I have recorded some mouse movements. When I replay them on my Windows 8.1 machine they look exactly like they look in realtime. However, when I replay them on a Windows 10 Pro machine they appear jerky.
I have tried recording the movements on Windows 10 and replaying them on that machine but I still get the same issue.
I have no idea why this is happening. Can anyone think of a reason?
Here's the code: