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)orget_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.targetcan be passed as((x, y), (r, g, b)),(x, y), (r, g, b), orx, y, (r, g, b).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80384a3c849963e12590f0a0271574c0e89af9020d7dca834b991c55685b99d1
|
|
| MD5 |
3b3d8f98af355773808ad76c14092e8b
|
|
| BLAKE2b-256 |
a6e4f0f0cd5601fcb206208b45392248fc2b2d03c0369906fdfd42bdf78c34ec
|
Provenance
The following attestation bundles were made for fast_pixel-1.1.0.tar.gz:
Publisher:
python-publish.yml on leofrachet11/fast-pixel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_pixel-1.1.0.tar.gz -
Subject digest:
80384a3c849963e12590f0a0271574c0e89af9020d7dca834b991c55685b99d1 - Sigstore transparency entry: 1978026828
- Sigstore integration time:
-
Permalink:
leofrachet11/fast-pixel@c7a34aedc35e687d95b0f73d530bb55a22765eb1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/leofrachet11
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c7a34aedc35e687d95b0f73d530bb55a22765eb1 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d889287d95e5596abfaa151aea1557bafc38fcfaa20c6b5c299d1b331274398
|
|
| MD5 |
e9e6511d63ddd558f44f6c6fc73ceda4
|
|
| BLAKE2b-256 |
0134aab6d0b81deaef436c54dd9762af0a15833e951f4f0af7c6fdc92db08994
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_pixel-1.1.0-py3-none-any.whl -
Subject digest:
9d889287d95e5596abfaa151aea1557bafc38fcfaa20c6b5c299d1b331274398 - Sigstore transparency entry: 1978026854
- Sigstore integration time:
-
Permalink:
leofrachet11/fast-pixel@c7a34aedc35e687d95b0f73d530bb55a22765eb1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/leofrachet11
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c7a34aedc35e687d95b0f73d530bb55a22765eb1 -
Trigger Event:
push
-
Statement type: