Skip to main content

GesturePlayKit 🖐️

Write interactive webcam apps in plain Python without rewriting MediaPipe setup or OpenCV image-overlays each time.

GesturePlayKit is an open-source-ready library scaffold (MIT licensed). It is not published on PyPI or GitHub yet. Its job is to supply reusable webcam, gesture and image primitives—not your application rules.

Installation (Windows PowerShell)

cd gestureplaykit
python -m pip install -e .

One-time download of Google's hand/face AI model files:

python -c "from gestureplaykit import download_models; print(download_models('models'))"

After this download, tracking works offline. If you use pictures from internet URLs, download those in advance too for offline use.

A tiny program

Save this as try_it.py in the project folder:

from gestureplaykit import Camera, Vision, load_picture, show_picture, show_text

chip = load_picture("examples/chip.png", size=(100, 100))

with Camera() as camera, Vision(models_dir="models") as vision:
    while True:
        frame = camera.read()
        if frame is None:
            break
        vision.update(frame)

        hand = vision.hand
        face = vision.face
        if hand and hand.pinching:
            show_picture(frame, chip, at=hand.pinch_center)
        if hand and hand.double_pinched:
            print("DOUBLE PINCH!")
        if face and face.mouth_open:
            show_text(frame, "MOUTH OPEN", at=(15, 70))

        if not camera.show(frame, title="My Project"):
            break

Press Q or Escape to exit.

Quick reference

What you want What to write
Open webcam with Camera() as camera:
Get video frame frame = camera.read()
Track hand and face vision.update(frame)
First hand found? if vision.hand:
Are thumb/index touching? if vision.hand.pinching:
Pinch began this frame? if vision.hand.pinch_started:
Double pinch this frame? if vision.hand.double_pinched:
Thumb tip coordinate hand.landmark(4)
Index tip coordinate hand.landmark(8)
Center between fingertips hand.pinch_center
Palm center hand.palm_center
Any landmarks touching? hand.touching(4, 12)
Is mouth open? if face and face.mouth_open:
Mouth just closed? if face and face.mouth_just_closed:
Mouth screen position face.mouth_center
Is pixel point near mouth? face.near_mouth((x, y), max_distance=70)
Local / web picture chip = load_picture("image.png") or load_picture("https://example.com/picture.png")
Draw picture show_picture(frame, chip, at=(x, y))
Draw text show_text(frame, "Hello!", at=(10, 30))
Display webcam if not camera.show(frame): break

Your own app logic

The library does not decide whether someone ate a chip, award points, freeze objects, manage skins, implement a shop, or save game state. Those are the interesting program features for you to design. Look at examples/03_build_your_own_game.py for an intentionally unfinished starter.

Images

load_picture(...) accepts local PNG/JPG or a direct HTTP(S) image URL. It downloads and decodes the URL only once per unique URL in the current Python process. For speed, load before entering the camera loop. Transparent PNGs are supported; pictures clip safely when partly offscreen.

The included examples/chip.png is a simple bundled example graphic; change it however you like.

Models and privacy

Hand and face detection runs on your computer, using Google MediaPipe Tasks. The library does not upload webcam frames. Calling download_models() or load_picture("https://...") connects to those respective web hosts. You may need to adjust gesture ratios in different lighting, with occlusions or different camera angles. The API only estimates apparent fingertip contact and mouth opening—it cannot prove actual touch or eating.

Build your own published package

python -m pip install build
python -m build

The generated .whl and .tar.gz appear under dist/. Read Python Packaging's publishing guidance before releasing to PyPI. You can also place this folder in a public GitHub repository, including LICENSE and README.md.

Attribution and competition honesty

This initial GesturePlayKit implementation and parts of its documentation were produced with AI assistance. Record that attribution if you reuse it. Open-source libraries may be cited, but your competition project's significant code must still be your own work. It is not enough to repackage an AI-written application behind a library. Build your original game rules, state transitions, interface, and other meaningful software yourself.

Testing

python -m pip install pytest
python -m pytest -q

Camera/model integration requires testing on your own hardware. Automated tests cover image overlays and public helper behavior using fake tracking results.

Metadata

Release files for gestureplaykit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gestureplaykit 0.1.0
File Size Uploaded Provenance Actions
gestureplaykit-0.1.0.tar.gz 13.9 kB Without provenance Details for gestureplaykit-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gestureplaykit 0.1.0
File Interpreter ABI Platform Actions
gestureplaykit-0.1.0-py3-none-any.whl Python 3 none any Details for gestureplaykit-0.1.0-py3-none-any.whl

Total release size: 25.5 kB

Release files / gestureplaykit-0.1.0.tar.gz

Download URL gestureplaykit-0.1.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
73f636b99344dceb5413f8b1f97f1124e8309e21f6fa918004784bdfb4341b90
BLAKE2b-256 checksum
How to use checksums
7380915c52cc6db507bd340112d2da7139e32c38f71fac6d44fbb56046a52247
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / gestureplaykit-0.1.0-py3-none-any.whl

Download URL gestureplaykit-0.1.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b07044847e91b59f92c9905e9c075f2d97a2390c15923d3b98b0ff1c4a24c657
BLAKE2b-256 checksum
How to use checksums
dcdc8e85bc007990fbbeeb1e35d927d3def92aa312fd586fd2425ec8de2854b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for gestureplaykit 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page