问题描述
尝试构建一个应用程序,以便在我的鼠标没有移动或滚动(通过滚轮)时进行打印。
这是我到目前为止所做的:
from pynput import mouse
import time
t = int(6)
def on_move(x,y):
print('Pointer moved to {0}'.format((x,y)))
t = int(6)
for t in range(6):
t = t -1
time.sleep(1)
print("Didn't Move!")
def on_scroll(x,y,dx,dy):
print('Scrolled {0} at {1}'.format('down' if dy < 0 else 'up',(x,y)))
t = int(6)
for t in range(6):
t = t -1
time.sleep(1)
print("Didn't Move!")
with mouse.Listener(on_move=on_move,on_scroll=on_scroll) as listener:
listener.join()
我在想一种每次鼠标移动或滚动但无法弄清任何东西时刷新for循环的方法。
我尝试在后台使用带有计时器的线程,但是仍然没有。
无论如何,所以代码无法正常工作。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)