我正在尝试使用pynput中的This脚本来监控我的鼠标,但它太耗费资源了。尝试在on_move(x, y)函数后添加import time和time.sleep(1),但当您运行它时,您的鼠标驱动器疯狂。下面是整体代码: import time
print('Pointer moved to {0}'.format((x, y)))
我想使用matplotlib和pynput近乎实时地绘制鼠标的移动,但我怀疑我的代码被阻塞了。代码使用的是的简化版本。= ax.plot(x, y, 'o')[0]background = fig.canvas.copy_from_bbox(ax.bbox)
# fill in the axes rectangle
with mouse.Listener(