🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

mopad

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mopad

An anywidget that allows gamepad input in Marimo

0.4.0
PyPI
Maintainers
1

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

PropertyTypeDescription
last_button_pressedintIndex of the last pressed button (-1 if none)
current_timestampfloatTimestamp of the most recent button press (ms)
previous_timestampfloatTimestamp of the previous button press (ms)
axeslist[float]Analog stick values: [left_x, left_y, right_x, right_y]
dpad_upboolTrue when D-pad up is pressed
dpad_downboolTrue when D-pad down is pressed
dpad_leftboolTrue when D-pad left is pressed
dpad_rightboolTrue when D-pad right is pressed
button_idintLegacy 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.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts