Skip to main content

A highly optimised, cross-platform mouse position and pixel color reader

Project description

Fast Pixel Scanner

A highly optimized, cross-platform Python library for reading mouse positions and pixel colors on Windows and macOS.

Installation

pip install fast-pixel

Usage

1. Basic Tracking

Continuously track the mouse position and the color beneath it. (Note the use of get_position_and_color to do this in one call).

import fast_pixel
import time

try:
    while True:
        (x, y), (r, g, b) = fast_pixel.get_position_and_color()
        print(f'X: {x} Y: {y} | RGB: ({r}, {g}, {b})', end = '\r')
        time.sleep(0.1)
except KeyboardInterrupt:
    print('\nExiting...')

2. Waiting for a Color

Pause your script until a specific pixel turns a specific color.

import fast_pixel

# Define your target: ((x, y), (R, G, B))
target = ((960, 700), (37, 74, 129))

print('Waiting for color...')
# Blocks until the color matches, checking every 0.05 seconds
if fast_pixel.wait_for_color(target, interval = 0.05):
    print('Color found!')
else:
    print('Timed out.')

API Reference

  • get_position() Returns current mouse coordinates as a tuple: (x, y).
  • get_color(x, y) or get_color((x, y)) Returns the RGB color at the specified coordinates as a tuple: (r, g, b).
  • get_position_and_color() Returns a nested tuple of the current position and color: ((x, y), (r, g, b)).
  • wait_for_color(target, interval = 0.1) Blocks until the target coordinates match the target color. target can be passed as ((x, y), (r, g, b)), (x, y), (r, g, b), or x, y, (r, g, b).

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

fast_pixel-1.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

fast_pixel-1.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file fast_pixel-1.1.0.tar.gz.

File metadata

  • Download URL: fast_pixel-1.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fast_pixel-1.1.0.tar.gz
Algorithm Hash digest
SHA256 80384a3c849963e12590f0a0271574c0e89af9020d7dca834b991c55685b99d1
MD5 3b3d8f98af355773808ad76c14092e8b
BLAKE2b-256 a6e4f0f0cd5601fcb206208b45392248fc2b2d03c0369906fdfd42bdf78c34ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_pixel-1.1.0.tar.gz:

Publisher: python-publish.yml on leofrachet11/fast-pixel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_pixel-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: fast_pixel-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fast_pixel-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d889287d95e5596abfaa151aea1557bafc38fcfaa20c6b5c299d1b331274398
MD5 e9e6511d63ddd558f44f6c6fc73ceda4
BLAKE2b-256 0134aab6d0b81deaef436c54dd9762af0a15833e951f4f0af7c6fdc92db08994

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_pixel-1.1.0-py3-none-any.whl:

Publisher: python-publish.yml on leofrachet11/fast-pixel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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