Skip to main content

GesturePlayKit 1.3.0 🖐️👄🕺

Make webcam games, interactive art, virtual props, motion controls, and experimental AR using simple Python functions.

GesturePlayKit wraps Google's MediaPipe Tasks: 21 hand landmarks, 478 face landmarks, 52 optional face-expression blendshapes, and 33 optional body-pose landmarks. You write your own rules, UI, achievements, art, and gameplay. Hand, mouth, eye, and body detections are approximations, not guaranteed physical contact or medical measurements.

Release: Source code for v1.3.0. A GitHub push does not automatically upload to PyPI; see publishing instructions.

Getting started

Python 3.10+ is supported when compatible MediaPipe binaries exist for your platform. Install from this repository:

python -m pip install .
python -m gestureplaykit download-models --poses

By default models go to ./models/, relative to the directory from which you start your program. All detection operates locally after the models are downloaded. The --poses flag adds the optional body model; without it you only download hand and face models.

Try examples/07_mouth_expressions.py or this minimal script:

from gestureplaykit import Camera, Vision, show_text

with Camera() as camera, Vision() as vision:
    while True:
        frame = camera.read()
        if frame is None:
            break
        vision.update(frame)
        if vision.hand and vision.hand.pinching:
            show_text(frame, "PINCH!", at=(20, 60))
        if vision.face and vision.face.mouth_open:
            show_text(frame, "MOUTH OPEN", at=(20, 100))
        if vision.face and vision.face.smiling:
            show_text(frame, "SMILING!", at=(20, 140))
        if not camera.show(frame):
            break

To use body tracking:

from gestureplaykit import Camera, Vision, draw_pose
with Camera() as camera, Vision(hands=False, faces=False, poses=True) as vision:
    while (frame := camera.read()) is not None:
        vision.update(frame)
        if vision.pose:
            draw_pose(frame, vision.pose)
            if vision.pose.arms_raised:
                print("Hands up!")
        if not camera.show(frame):
            break

Features

  • Hand gestures: pinch hold/start/end/double, fingertip contact, open palm, fist, peace sign, pointing, finger count, palm position, estimated handedness, multiple-hand IDs, and approximate world coordinates.
  • Face: mouth open/close events and position, eye positions, mouth width/height, blink events, smile, wink, brow/jaw and 52 other optional expression scores, 478 landmarks, and optional transformation matrix.
  • Body: 33 pose landmarks, shoulders/hips centers, raised arms, elbow/knee angles, point visibility, and skeleton drawing.
  • Image/overlay: local or HTTP(S) PNG/JPG, alpha blending, opacity, resizing, cropping to frame, text, points, lines and rectangles. One-command picture visibility toggle (hide_all_pictures(), show_all_pictures(), toggle_pictures()).
  • Offline once models and any remote images have been downloaded; no camera data is uploaded by this library.
  • Sound-effect toolkit: play_sound("chomp.wav"), original built-in pop/chomp/success/error effects, and global mute/toggle controls. Windows WAV works with Python alone; optional Pygame enables cross-platform sound and volume.
  • Model downloader (python -m gestureplaykit download-models) and tested Python-first API.

Hide all pictures with one command

from gestureplaykit import show_picture, hide_all_pictures, show_all_pictures

hide_all_pictures()  # Every future show_picture() call draws nothing.
show_all_pictures()  # Display picture overlays again.

toggle_pictures() flips the current setting; pictures_visible() returns True or False. This switch affects picture overlays drawn with show_picture() only. It does not blank the webcam, remove text or landmarks, or erase images already drawn on an existing frame. In a normal camera loop, the next fresh frame will be clear. See example 10.

Sound effects (new in v1.3.0)

from gestureplaykit import play_sound, play_effect, mute_sounds, unmute_sounds

play_effect("pop")           # built-in original sound, no WAV file needed
play_sound("my-chomp.wav")   # your own sound file
play_effect("chomp")         # built-in chomp
mute_sounds()                # all new sounds stay muted
unmute_sounds()

Also available: toggle_sounds(), sounds_enabled(), stop_sounds(), set_sounds_enabled(True/False), and available_effects().

Sound playback does not block your webcam loop. On Windows, WAV files work with built-in winsound (one sound at a time, full volume). For overlapping sounds, volume adjustment, MP3/OGG, and Linux/macOS install:

python -m pip install ".[audio]"       # when inside a repository checkout
# or: python -m pip install "gestureplaykit[audio]"   # after publishing on PyPI

With the optional Pygame backend:

play_sound("my-chomp.wav", volume=0.5)
play_effect("success", volume=0.7)

Missing sound files raise FileNotFoundError; unavailable audio backends raise an actionable RuntimeError. Mute/unmute affects future sound playback and muting stops sounds already playing. See Audio example.

Complete documentation

Important limitations

Camera and model accuracy depend on lighting, occlusion, frame rate, and angles. hand.id is best-effort and may change when hands leave or cross; detected handedness may appear reversed in a mirrored view. Pixel distances change with perspective. Face.smiling, blink detection, and Pose.arms_raised are heuristics and not robust biometric or safety assessments. Face tracking currently selects the first detected face. Models are downloaded separately; they are not included in the wheel.

Credits and licenses

GesturePlayKit uses MediaPipe, OpenCV and NumPy. MediaPipe models have their own terms. See LICENSE (MIT) for the GesturePlayKit source and Development attribution for its development history.

Metadata

Release files for gestureplaykit 1.3.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 1.3.0
File Size Uploaded Provenance Actions
gestureplaykit-1.3.0.tar.gz 61.8 kB Without provenance Details for gestureplaykit-1.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 87.7 kB

Release files / gestureplaykit-1.3.0.tar.gz

Download URL gestureplaykit-1.3.0.tar.gz
Size 61.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bbe31f1019d5683d8f8b31c9ca64ebdb4c4c7850fd5f72bdc79ed0bf277b7ced
BLAKE2b-256 checksum
How to use checksums
036c59197f5204552e5d58f161928a8f0c158a1bbe1002fcd6e245cae00800d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

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

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

Security for gestureplaykit 1.3.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