Python Human Movements is a python package which imitates human movements
Author: Joe Tilsed | Created: 19.06.2020 | Last Updated: 31.10.2022 | Version 0.0.7
pyHM
Python Human Movements is a python package which imitates human movements.
Installation
$ pip install pyHM
Getting Started
Mouse
Importing the mouse object from the parent package.
from pyHM import mouse
print(type(mouse))
>> <class 'mouse.Mouse'>
Mouse.move()
Have your mouse move across your screen to an (x, y) coordinate like a human would.
from pyHM import mouse
destination_x = 16
destination_y = 25
mouse.move(destination_x, destination_y)
>> *Your mouse cursor moves to (16, 25) as if it were a human*
You can also add a multiplier which will either speed-up or slow down the mouse movement depending on what you want.
The higher the number the slower the movement, you can also have floats such as 0.1337.
from pyHM import mouse
x = 5
y = 2
mouse.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_current_position()
This will return your mouses current x and y coordinate.
from pyHM import mouse
print(mouse.get_current_position())
>> (1954, 122)
Mouse.click()
Will click wherever the mouse is, unless parsed with either and x or a y or both.
With just the x value parsed the y value will be your current y position.
With just the y value parsed the x value will be your current x position.
If both x and y are parsed, the cursor will move there first then click.
Note: All movements carried out using the Mouse.move() method so will still be human-like.
For the below examples, assume your current mouse position is (160, 400)
Example with no X or Y
from pyHM import mouse
mouse.click()
>> *Your mouse clicks where it is*
Example with X but no Y
from pyHM import mouse
mouse.click(x=50)
>> *Your mouse cursor moves to (50, 400) as if it were a human
and then clicks*
Example with not X but with Y
from pyHM import mouse
mouse.click(y=20)
>> *Your mouse cursor moves to (160, 20) as if it were a human
and then clicks*
Example with both X and Y
from pyHM import mouse
mouse.click(x=50, y=20)
>> *Your mouse cursor moves to (50, 20) as if it were a human
and then clicks*
Mouse.double_click()
The same with click as far as X and Y parameters, however the click will be a double left click.
The interval between each click will be random between 0.001 to 0.499 seconds.
from pyHM import mouse
mouse.double_click()
>> *Your mouse double left clicks where it is*
Mouse.right_click()
Exactly the same as Mouse.click() but with the right button.
from pyHM import mouse
mouse.right_click()
>> *Your mouse right clicks where it is*
Mouse.down()
Holds down the mouse button, default is your left button, however you can parse button='right' for the right button to be used.
Example with no arguments
from pyHM import mouse
mouse.down()
>> *Your mouse left button is held down*
Example with right button argument
from pyHM import mouse
mouse.down(button='right')
>> *Your mouse right button is held down*
Mouse.up()
Alike Mouse.down() but lifts up the mouse button, default is your left button, however you can parse button='right' for the right button to be used.
Example with no arguments
from pyHM import mouse
mouse.up()
>> *Your mouse left button is released*
Example with right button argument
from pyHM import mouse
mouse.up(button='right')
>> *Your mouse right button is released*
# That's all folks...
Metadata
Release files for pyHM 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyHM-0.0.7.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyHM-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / pyHM-0.0.7.tar.gz
| Download URL | pyHM-0.0.7.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe4d66a61af30085fe5678d728820d0860738d2ebe3babd318fe7f8052320cd0
|
|
BLAKE2b-256 checksum How to use checksums |
940240cd1b83366804cf23bad65b8f51413fd20e0ffe88c7bf2686d2014ea42e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.0
|
Release files / pyHM-0.0.7-py3-none-any.whl
| Download URL | pyHM-0.0.7-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5d8000a067b4cf7187728d3ab90b57eb4dc8dd2a022dacfba5fc4443aa1b0e3
|
|
BLAKE2b-256 checksum How to use checksums |
7b6487ecf0eade6e0ff593219fa2790ddda2111183881d5946cc7cb384a985c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.0
|