mopad
An anywidget that allows gamepad input in Marimo notebooks. Perfect for interactive data exploration, games, or any application that needs real-time gamepad input.
Features
- 🎮 Automatic gamepad detection - No need to press buttons before starting
- 📊 Real-time visual feedback - Connection status and button press information
- ⏱️ Precise timestamp tracking - Millisecond-accurate timing for button presses
- 🔗 Any button support - Capture input from any bluetooth gamepad
Installation
pip install mopad
Usage
Basic Example
import marimo as mo
from mopad import MopadWidget
# Create and display the widget
gamepad = mo.ui.anywidget(MopadWidget())
gamepad
For a full demo you can check Github pages.
Widget Properties
| Property | Type | Description |
|---|---|---|
last_button_pressed |
int |
Index of the last pressed button (-1 if none) |
current_timestamp |
float |
Timestamp of the most recent button press (ms) |
previous_timestamp |
float |
Timestamp of the previous button press (ms) |
axes |
list[float] |
Analog stick values: [left_x, left_y, right_x, right_y] |
dpad_up |
bool |
True when D-pad up is pressed |
dpad_down |
bool |
True when D-pad down is pressed |
dpad_left |
bool |
True when D-pad left is pressed |
dpad_right |
bool |
True when D-pad right is pressed |
button_id |
int |
Legacy property for backward compatibility |
| k |
Gamepad Setup
- Connect your gamepad to your computer (USB or Bluetooth)
- Press any button on the gamepad to activate it in the browser
- Start the widget - it will automatically detect the connected gamepad
Note: Due to browser security policies, gamepads need user interaction to be detected. The widget will guide you through the connection process with clear visual indicators.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for mopad 0.4.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 |
|---|---|---|---|---|
| mopad-0.4.0.tar.gz | 7.7 kB | Without provenance | Details for mopad-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mopad-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for mopad-0.4.0-py3-none-any.whl |
Total release size: 15.0 kB
Release files / mopad-0.4.0.tar.gz
| Download URL | mopad-0.4.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
971382faccdb3e316135117a88ba5d81764e95413caa163972c96d5092dc5e3a
|
|
BLAKE2b-256 checksum How to use checksums |
7dae7ee0f1f44b81032918d882fcf05218d7560c5ee02110f231b6c106ed393b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.7
|
Release files / mopad-0.4.0-py3-none-any.whl
| Download URL | mopad-0.4.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ed0e4227606dd022180cb587104ff7289dea253fde0dd4c6037916ae4a3ffc1
|
|
BLAKE2b-256 checksum How to use checksums |
61a4eace80759a8888dff0a49843060d053cc3508e89d3278cef759515ccc761
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.7
|
Security for mopad 0.4.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.