Skip to main content

A Python package for smooth mouse movement using a C library.

Project description

Mouse Anywhere

PyPI Version Build Status License Python Versions

Mouse Anywhere Banner


Table of Contents


Introduction

Mouse Anywhere is a Python package designed for precise and programmable mouse movements on Windows. Built on a high-performance C-based DLL, it offers features like advanced easing types, smooth cursor transitions, and target queueing, making it perfect for automation, testing, or gaming tasks.


Features

  • Smooth Movement Profiles: Sinusoidal, quadratic, cubic, exponential, and linear easing.
  • Absolute and Relative Movement: Move the cursor by screen coordinates or relative offsets.
  • Multi-Target Queue: Queue multiple movements for seamless transitions.
  • Click Functionality: Simulate left, right, or middle mouse clicks.
  • High-Performance C Backend: Leverages native Windows API for efficiency.
  • Cross-Monitor Precision: Ensures movements respect all screen boundaries.
  • Detailed Logs: Track mouse movements and actions.

Why Mouse Anywhere?

Mouse Anywhere surpasses other Python libraries like pyautogui by offering:

  • Advanced Easing: Human-like smoothness for mouse movements.
  • Queue Management: Stack and execute multiple cursor actions in sequence.
  • Performance: Built with a robust C library for minimal latency.
  • Versatility: Suitable for both high-speed automation and interactive applications.

Installation

Install Mouse Anywhere via PyPI:

pip install mouse-anywhere

Requirements

  • Windows OS
  • Python 3.6+
  • The mouse-anywhere.dll file is included in the package.

Quick Start

Here's a minimal example to get started:

from mouse_anywhere import initialize, shutdown, set_cursor_abs, perform_click

# Initialize the DLL
initialize()

# Move the cursor to an absolute position
set_cursor_abs(500, 500)

# Perform a left click
perform_click(1)

# Shutdown the DLL
shutdown()

Detailed Usage

Initialization

Start by initializing the DLL:

from mouse_anywhere import initialize, shutdown

# Initialize
initialize()

# Perform cursor actions here

# Shutdown
shutdown()

Adding Targets

Absolute Targeting

Queue a movement to a specific position:

from mouse_anywhere import enqueue_target_abs

# Queue a movement to position (600, 400)
enqueue_target_abs(600, 400)

Relative Targeting

Queue a movement relative to the current position:

from mouse_anywhere import enqueue_target_rel

# Move 50 pixels right and 30 pixels down
enqueue_target_rel(50, 30)

Clicking the Mouse

Simulate mouse clicks with perform_click. Supported buttons:

  • 1: Left click
  • 2: Right click
  • 3: Middle click
from mouse_anywhere import perform_click

# Perform a left click
perform_click(1)

# Perform a right click
perform_click(2)

Customizing Movement

Adjust easing type and movement strength for smoother animations.

from mouse_anywhere import set_cursor_abs

# Set cursor with easing and smooth movement
set_cursor_abs(800, 300)

Easing Types

Type Description
EASE_LINEAR (1) Constant speed.
EASE_QUADRATIC (2) Smooth acceleration using a quadratic curve.
EASE_SINUSOIDAL (3) Sinusoidal easing for natural movement.
EASE_CUBIC (4) Faster easing with a cubic curve.
EASE_EXPONENTIAL (5) Exponential acceleration for rapid movement.

Low-Level API (DLL Integration)

For advanced use cases, interact directly with the DLL:

from ctypes import CDLL

# Load the DLL
dll = CDLL('mouse-anywhere.dll')

# Initialize the DLL
dll.initialize()

# Move the cursor
dll.set_cursor_abs(500, 500)

# Shutdown the DLL
dll.mouse_shutdown()

Logging

Mouse Anywhere automatically logs all actions to mouse_movement.log.

Sample Log:

[2024-12-23 14:35:22] DLL initialized.
[2024-12-23 14:35:25] Enqueued target: (1000, 800) [Absolute]
[2024-12-23 14:35:27] Cursor moved to (1000, 800).
[2024-12-23 14:35:30] DLL shutdown.

Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository: Mouse Anywhere
  2. Create a feature branch: git checkout -b feature-name
  3. Implement your changes.
  4. Submit a pull request.

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

mouse-anywhere-0.2.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mouse_anywhere-0.2.1-py3-none-any.whl (108.8 kB view details)

Uploaded Python 3

File details

Details for the file mouse-anywhere-0.2.1.tar.gz.

File metadata

  • Download URL: mouse-anywhere-0.2.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.13

File hashes

Hashes for mouse-anywhere-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1dc496a71d8d393b9db74fc04d991c8fbc6483c0b4d233ae12d46e326cab4f03
MD5 fde1e03ec353e9fb0845c71a6b409f6d
BLAKE2b-256 42724e174842779a3d6f6bbb518b776e20fdd2128f7d1d1e5e5b8762ab5fee6a

See more details on using hashes here.

File details

Details for the file mouse_anywhere-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: mouse_anywhere-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 108.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.13

File hashes

Hashes for mouse_anywhere-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48f778edbc10516fcf8a3e40ce6f10d925c2a23c785f6f4d676e07e8b791c74f
MD5 d5cc713f8a044f5a8dfd39a4eb3151d1
BLAKE2b-256 8df771dc03544b437eabb91b96c01fb81eef5d858b6c80a7d00fef95b06c13d5

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