Python人类运动是一个Python软件包,它模仿人类的运动
pyHM的Python项目详细描述
Python人类运动是一个Python软件包,它模仿人类的运动
作者:Joe Tilsed|创建时间:19.06.2020 |最后更新时间:20.06.2020 |版本0.0.5
皮姆
Python人类运动是一个Python软件包,它模仿人类的运动。在
安装
$ pip install pyHM
入门
鼠标
从父包导入鼠标对象。在
^{pr2}$>> <class 'mouse.Mouse'>
鼠标.移动()
让你的鼠标像人类一样在屏幕上移动到(x, y)
坐标。在
frompyHMimportmousedestination_x=16destination_y=25mouse.move(destination_x,destination_y)
>> *Your mouse cursor moves to (16, 25) as if it were a human*
你也可以添加一个乘数,它可以根据你的需要来加速或减缓鼠标的移动。
数字越大,移动越慢,也可以使用浮动,例如0.1337
。在
frompyHMimportmousex=5y=2mouse.move(x,y,multiplier=10)
>> *Your mouse cursor moves to (5, 2) as if it were a human
at about 10 times the speed*
你知道吗Mouse.get_当前位置()
这将返回鼠标当前的x和y坐标。在
frompyHMimportmouseprint(mouse.get_current_position())
>> (1954, 122)
你知道吗鼠标.单击()
将单击鼠标所在的任何位置,除非使用and
xor
a y或两者都解析。
只分析了x
值,y值就是您的current y
位置。
只要解析y
值,x值将是您的current x
位置。
如果x
和y
都被解析,光标将首先移动到那里,然后单击。
注意:使用Mouse.move()
方法执行的所有动作仍将与人类相似。在
对于下面的示例,假设您当前的鼠标位置是(160400)
没有X或Y的示例
frompyHMimportmousemouse.click()
>> *Your mouse clicks where it is*
示例有X但没有Y
frompyHMimportmousemouse.click(x=50)
>> *Your mouse cursor moves to (50, 400) as if it were a human
and then clicks*
示例中没有X,但有Y
frompyHMimportmousemouse.click(y=20)
>> *Your mouse cursor moves to (160, 20) as if it were a human
and then clicks*
同时使用X和Y的示例
frompyHMimportmousemouse.click(x=50,y=20)
>> *Your mouse cursor moves to (50, 20) as if it were a human
and then clicks*
你知道吗鼠标。双击()
与click as to X
和Y
参数相同,但是单击将是左键双击。
每次单击之间的时间间隔将随机介于0.001到0.499秒之间。在
frompyHMimportmousemouse.double_click()
>> *Your mouse double left clicks where it is*
你知道吗鼠标右键单击()
与Mouse.click()
完全相同,但使用了右键。在
frompyHMimportmousemouse.right_click()^{pr21}$
你知道吗鼠标.向下()
按住鼠标键,默认为左键,但是您可以解析button='right'
以使用右键。在
没有参数的示例
frompyHMimportmousemouse.down()
>> *Your mouse left button is held down*
带有右键参数的示例
frompyHMimportmousemouse.down(button='right')
>> *Your mouse right button is held down*
你知道吗鼠标。向上()
与Mouse.down()
相似,但是抬起鼠标按钮,默认情况下是您的左按钮,但是您可以解析button='right'
以使用右按钮。在
没有参数的示例
frompyHMimportmousemouse.up()
>> *Your mouse left button is released*
带有右键参数的示例
frompyHMimportmousemouse.up(button='right')
>> *Your mouse right button is released*
所有人都是这样…- 项目
标签: