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.1.4.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.1.4-py3-none-any.whl (108.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mouse-anywhere-0.1.4.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.1.4.tar.gz
Algorithm Hash digest
SHA256 b84bdb654a2d10567b2caad66e78911c2db97ac636f183d74fc2dfa75c6a112b
MD5 ddc868cf39d651dcc14aae2a5d4128b3
BLAKE2b-256 91c0522c5dd4c9f82ba3689d54c8daf368e8aea8e5bf1c500c87607f3646a350

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mouse_anywhere-0.1.4-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.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 32465227cbd67b926d4d617c0842158caaba408fb75cfca477bea47b76c5323c
MD5 7e446a2969110001267655b6ccb508d1
BLAKE2b-256 cad2efb7315e43c4f42982be6ec959506185a35721b7b4c6c73fd14cb1a507f5

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