【问题标题】:How to change the mouse movement speed with win32api (mouseeventf_move)如何使用 win32api (mouseeventf_move) 改变鼠标移动速度
【发布时间】:2023-01-21 19:56:23
【问题描述】:

所以我基本上设置了一个 python 脚本,将游戏中的鼠标移动到特定的 x 和 y 坐标,我现在的问题是我怎样才能让它移动得更慢,但从点 a 到点 b 仍然平滑?我尝试了 sleep 命令,但这只是让它移动起来不流畅,而是非常机器人化。我的代码:

if keyboard.is_pressed("Alt"):  
              win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(x), int(y), 0, 0)
              time.sleep(.02)  

【问题讨论】:

    标签: python winapi pywin32 win32con


    【解决方案1】:

    我刚刚知道怎么做!您只需调用 WinAPI 来调用鼠标并将其乘以平滑值。平滑值越高,它进行得越快。它看起来像这样:

    win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(x) * smoothing, int(y) * smoothing, 0, 0)
    

    【讨论】:

      猜你喜欢
      • 2011-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      相关资源
      最近更新 更多