问题描述
我目前正在使用拦截驱动程序(https://github.com/cobrce/interception_py,它是https://github.com/oblitum/Interception的端口)使用python编写程序。问题是当我创建鼠标笔划并分配目标x和y值并将其发送到设备,而不是直接将其移动到目标时,它将鼠标光标从当前位置向右移动X像素(如果为负,则向左移动) ),Y像素向下(如果为负,则向上),我想要的是计算相对于目标的鼠标相对位置。我目前有这些值:目标X和Y值,鼠标光标X和Y值,屏幕宽度和高度:
我的代码:
c = interception()
c.set_filter(interception.is_mouse,interception_filter_mouse_state.INTERCEPTION_FILTER_MOUSE_ALL.value)
while True:
device = c.wait()
stroke = c.receive(device)
mouse = pyautogui.position()
x = mouse.x
y = mouse.y
print(x,y,sep=',')
goalx = 400
goaly = 600
screenx = 1920
screeny = 1080
#this is where i need help
stroke.x =
stroke.y =
print(stroke.x,stroke.y,')
c.send(device,stroke)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)