Skip to main content

PyHuTool lets Python control the mouse and keyboard, and other GUI automation tasks. For Windows, macOS, and Linux

Project description

PyHuTool

Python版HuTool

Setup

pip install pyhutool

Example Usage

Keyboard and Mouse Control

    >>> import pyhutool
    >>> screenWidth, screenHeight = pyhutool.size() # Returns two integers, the width and height of the screen. (The primary monitor, in multi-monitor setups.)
    >>> currentMouseX, currentMouseY = pyhutool.position() # Returns two integers, the x and y of the mouse cursor's current position.
    >>> pyhutool.moveTo(100, 150) # Move the mouse to the x, y coordinates 100, 150.
    >>> pyhutool.click() # Click the mouse at its current location.
    >>> pyhutool.click(200, 220) # Click the mouse at the x, y coordinates 200, 220.
    >>> pyhutool.move(None, 10)  # Move mouse 10 pixels down, that is, move the mouse relative to its current position.
    >>> pyhutool.doubleClick() # Double click the mouse at the
    >>> pyhutool.moveTo(500, 500, duration=2, tween=pyhutool.easeInOutQuad) # Use tweening/easing function to move mouse over 2 seconds.
    >>> pyhutool.write('Hello world!', interval=0.25)  # Type with quarter-second pause in between each key.
    >>> pyhutool.press('esc') # Simulate pressing the Escape key.
    >>> pyhutool.keyDown('shift')
    >>> pyhutool.write(['left', 'left', 'left', 'left', 'left', 'left'])
    >>> pyhutool.keyUp('shift')
    >>> pyhutool.hotkey('ctrl', 'c')

Screenshot Functions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyHuTool-0.0.4.tar.gz (21.7 kB view details)

Uploaded Source

File details

Details for the file PyHuTool-0.0.4.tar.gz.

File metadata

  • Download URL: PyHuTool-0.0.4.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

File hashes

Hashes for PyHuTool-0.0.4.tar.gz
Algorithm Hash digest
SHA256 5d4ff420e6a8ddbc6ea335423f81ddc6a7ff1cbddb91791b3efe4822b680a331
MD5 12e31fc8ad8860d41520bc55c11d5ed4
BLAKE2b-256 c473d1ce77378b48ceda5ea8534ef28f82658b0e48f94e817c108f71408a5e0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page