Skip to main content

mouse-track

A Reflex custom component mouse-track.

Installation

pip install reflex-mouse-track

Example:

@dataclasses.dataclass
class Point:
    """Point dataclass."""

    x: int
    y: int

class MouseTrackState(rx.State):
    def handle_click(self, mouse: Point):
        """Handle click event."""
        yield rx.toast(f"Click event: {mouse}")

def tracking_area():
    return mouse_track(
        background_color="gray",
        on_click=MouseTrackState.handle_click,
        width="100vw",
        height="100vh",
    )

API

  • Event Triggers:
    • on_click: Triggered when the user clicks on the tracking area.
    • on_mouse_down: Triggered when the user press a mouse button on the tracking area.
    • on_mouse_up: Triggered when the user releases the mouse on the tracking area.

Known errors:

  • When trying to access MousePosition, if you get an error saying 'mouse' is undefined, you might need to decorate the global function where you do the mouse tracking with @rx.memo.

Metadata

Release files for reflex-mouse-track 0.0.1

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

Source distribution (sdist)

Source distribution for reflex-mouse-track 0.0.1
File Size Uploaded
reflex_mouse_track-0.0.1.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for reflex-mouse-track 0.0.1
File Interpreter ABI Platform
reflex_mouse_track-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.7 kB

Release files / reflex_mouse_track-0.0.1.tar.gz

Download URL reflex_mouse_track-0.0.1.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a133bca0d9fe735cc8e8dd54eef79d1ff5cb3a77ef1bc39276cccc6c0b897e58
BLAKE2b-256 checksum
How to use checksums
9ea3d665ba2dafc27a00d8ea4a1ff149e3d094f09f7ab28bf6f38d30e0f18e45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Release files / reflex_mouse_track-0.0.1-py3-none-any.whl

Download URL reflex_mouse_track-0.0.1-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
737710f44a7ac3440ed623fa8c1903452f8b9a4fbf8ad7a9c2a00740851daa75
BLAKE2b-256 checksum
How to use checksums
ee7b6b462cf9d519f8e72fe4a69519e243a5e7e3e7daeb6fd923c14e04ecc02b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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