Skip to main content

No project description provided

Project description

brushable_widget

An anywidget that adds a brush to SVG plots.

Installation

pip install brushable_widget

or with uv:

uv add brushable_widget

Example

An example marimo script (available as example.py => run with uv run marimo edit example.py).

IMPORTANT: the SVG elements that should be brushable should:

  • have "brushable" in their class_
  • have an ID
import marimo as mo
from svg import SVG, Circle
import random
import brushable_widget

datapoints = []
for _i in range(20):
    datapoints.append({
        'x': random.randint(20,180),
        'y': random.randint(20,180),
        'z': random.randint(20,180),
        'id': _i
    })

circles = []
for datapoint in datapoints:
    circles.append(Circle(
        cx=datapoint['x'],
        cy=datapoint['y'],
        r=10,
        fill="steelblue",
        fill_opacity=0.5,
        stroke_width=1,
        stroke="white",
        class_="jfsi2 brushable",
        id=datapoint['id']
    ))

svg = SVG(
    class_="notebook",
    width=200,
    height=200,
    elements=[circles]
)

x = mo.ui.anywidget(brushable_widget.BrushableWidget(svg=svg.as_str(), selected_ids = []))

x

x.selected_ids

Development

We recommend using uv for development. It will automatically manage virtual environments and dependencies for you.

uv run jupyter lab example.ipynb

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brushable_widget-0.1.8.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brushable_widget-0.1.8-py2.py3-none-any.whl (9.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file brushable_widget-0.1.8.tar.gz.

File metadata

  • Download URL: brushable_widget-0.1.8.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.13

File hashes

Hashes for brushable_widget-0.1.8.tar.gz
Algorithm Hash digest
SHA256 eb49408b26669c722152b68de608165779fe3036d8618e79d4d2b214595ec0ec
MD5 d1bbfbce0d65cb13f286b036d69d0274
BLAKE2b-256 4f12774181104b8df239a05d84db2a0dc2f31a42e11fcecebbe77b296a804fb4

See more details on using hashes here.

File details

Details for the file brushable_widget-0.1.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for brushable_widget-0.1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d69844e150af4eec17fae5cc5b451199041d98de303309983688cdead502cc93
MD5 83ffba86a6c84ee07dbc86055b2503b9
BLAKE2b-256 fbcf2b5a621c22c98ef12f94681078d8f33eb960bdf90403e9eee58c84ab8f30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page