GesturePlayKit 1.0.0 🖐️
Build Python webcam games and interactive art without writing the MediaPipe setup yourself. GesturePlayKit gives you clear, readable hand gestures, mouth state, drawing functions, and tiny geometry helpers. You write the actual program, its rules, menus, and score.
Release status: v1.0.0 source package and distribution archives are prepared. This repository/ZIP by itself does not publish anything to PyPI.
Install
Python 3.10+ on Windows, macOS or Linux (subject to the availability of MediaPipe wheels for your OS/Python version):
python -m pip install .
If you publish v1.0.0 to PyPI later, users can install it with python -m pip install gestureplaykit==1.0.0.
Download the official Google hand and face models once:
python -m gestureplaykit download-models
This creates models/hand_landmarker.task and models/face_landmarker.task. Afterwards, webcam tracking works offline. Downloading images by URL still requires internet.
Or download only one tracking model:
python -m gestureplaykit download-models --hands-only
python -m gestureplaykit download-models --faces-only
If your script lives in another directory, pass a model folder explicitly: Vision(models_dir="C:/path/to/models"). The default is models relative to your current working directory.
First program
Create hello.py next to the models folder:
from gestureplaykit import Camera, Vision, show_text, draw_hand
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
if hand:
draw_hand(frame, hand)
if hand.pinch_started:
print("Pinch started!")
if hand.pinching:
show_text(frame, "PINCHING!", at=(15, 70))
if hand.double_pinched:
print("Double pinch!")
if vision.face and vision.face.mouth_open:
show_text(frame, "MOUTH OPEN", at=(15, 105))
if not camera.show(frame, title="My gesture app"):
break
Press Q or Escape to close the window. The camera requires local webcam permission.
Quick reference
| Purpose | Example |
|---|---|
| Open camera | with Camera(index=0) as camera: |
| Read frame | frame = camera.read() |
| Analyze frame | vision.update(frame) |
| First hand | vision.hand (or None) |
| Multiple hands | for hand in vision.hands: |
| Pinching now | hand.pinching |
| New pinch this frame | hand.pinch_started |
| Release this frame | hand.pinch_ended |
| Double-pinch this frame | hand.double_pinched |
| Pinch position | hand.pinch_center |
| Palm position | hand.palm_center |
| Thumb tip | hand.landmark(4) |
| Index tip | hand.landmark(8) |
| Two landmarks touching | hand.touching(4, 12) |
| Finger extended | hand.finger_up("index") |
| All finger estimates | hand.fingers_up |
| Open palm / fist | hand.open_palm / hand.fist |
| Estimated hand ID | hand.id |
| Mouth open | face.mouth_open |
| Mouth opened this frame | face.mouth_just_opened |
| Mouth closed this frame | face.mouth_just_closed |
| Mouth center | face.mouth_center |
| Point near mouth | face.near_mouth((x, y), 50) |
| Load local/URL picture | load_picture("chip.png") |
| Change picture size | resize_picture(chip, (90, 90)) |
| Draw with transparency | show_picture(frame, chip, at=(x,y), opacity=0.7) |
| Draw text | show_text(frame, "HI!", at=(15,30)) |
| Draw point / line | show_point(...), show_line(...) |
| Draw rectangle | show_rectangle(frame, (0,0,100,50)) |
| Draw hand outline | draw_hand(frame, hand, number_landmarks=True) |
| Geometry | distance(a,b), clamp(v,0,1), inside_rectangle(point,rect) |
| Reset tracking history | vision.reset() |
v1 additions
- Draw a full hand skeleton and optional landmark numbers with
draw_hand. - Estimate each raised finger, an open palm, or a fist.
- New drawing primitives:
show_line,show_rectangle,resize_picture, and opacity inshow_picture. - New geometry helpers:
distance,clamp,inside_rectangle. - Best-effort, frame-to-frame tracking IDs for multiple hands so gesture state is less likely to transfer to the wrong hand when tracker result order changes.
- Sensible parameter validation, safer image loading, improved model download logic, expanded tests, and simple CLI model downloads.
- Fully maintains the previous v0.1 public calls and default parameters. See
CHANGELOG.mdandUPGRADING.md.
Multiple hands
vision.update(frame)
for hand in vision.hands:
if hand.pinching:
show_picture(frame, sprite, at=hand.pinch_center)
hand.id is not an identifying characteristic of a human. It's a best-effort temporary number for one tracked hand; IDs may change when hands overlap, move quickly or leave view. vision.hand continues to be the first detected hand.
Load images from the internet
from gestureplaykit import load_picture, show_picture
sprite = load_picture("https://example.org/direct-image.png", size=(120, 120))
# Do this outside your camera loop to avoid network delay.
show_picture(frame, sprite, at=(200, 150), opacity=0.85)
The URL must return actual image bytes (not an HTML page). Only HTTP(S) image downloads are supported; local PNG/JPEG images work offline. Decoded images are cached, and the caller receives a copy. Image files are limited to 15 MB and 40 million decoded pixels.
Accuracy and privacy
GesturePlayKit computes approximate pinches and mouth opening from 2-D landmarks, not actual physical contact or eating. Performance depends on lighting, hand pose, occlusion, and camera speed. Open-palm/fist estimates are especially approximate when the hand is edge-on. The two-hand ID matcher uses nearest-palm matching and may swap IDs when hands cross.
MediaPipe processes the webcam feed locally. GesturePlayKit does not upload camera frames. download_models and image URL downloads make requests to the host you specify.
Build, test, contribute
python -m pip install -e ".[test]"
python -m pytest -q
python -m pip install build twine
python -m build
python -m twine check dist/*
See PUBLISH_TO_PYPI.md for the upload steps, AI_ATTRIBUTION.md for provenance, and CONTRIBUTING.md for development guidance.
Competition note: This library was written with substantial AI assistance. Open-sourcing it or releasing a v1 does not turn that source into independent student-authored work. Applications can use it as a documented dependency, but you should personally write and understand the meaningful application logic and follow your competition's disclosure rules.
Metadata
Release files for gestureplaykit 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gestureplaykit-1.0.0.tar.gz | 97.3 kB | Without provenance | Details for gestureplaykit-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gestureplaykit-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for gestureplaykit-1.0.0-py3-none-any.whl |
Total release size: 115.4 kB
Release files / gestureplaykit-1.0.0.tar.gz
| Download URL | gestureplaykit-1.0.0.tar.gz |
|---|---|
| Size | 97.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a56486f914e1bd59a0a2cc89173d7fc9d6ec3b3470417d87e9321a7e1ad3e12a
|
|
BLAKE2b-256 checksum How to use checksums |
3fdbfd24d58c405675406588986de18d609031dc4958780ba911eb3de1d18e4d
|
| 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.0.0-py3-none-any.whl
| Download URL | gestureplaykit-1.0.0-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1fd3de44b23f889b47182faa1831e2bda8f403dee527cbe4483dd46277c4afd4
|
|
BLAKE2b-256 checksum How to use checksums |
11d014bad00847d7c68d0a5e0e46500324415360a38103639b4e832d1ee16a8a
|
| 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.0.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.