Skip to main content

Collection of Anywidget Widgets

Project description

modraw

"A collection of tldraw based anywidgets for marimo, but also other Python notebooks."

The project uses anywidget under the hood so our tools should work in Marimo but also Jupyter, Shiny for Python, VSCode, Colab, Solara and Marimo. Because of the anywidget integration you should also be able interact with ipywidgets natively.

Online demos

Check Github pages for a live demo.

Installation

Installation occurs via pip or uv.

python -m pip install modraw
uv pip install modraw

Usage

Draw

The main widget that's available in this library is the Draw widget. This generates a ltdraw widget and you're able to retreive the drawn image in a base64 representation or as a Python image object.

import marimo as mo
from modraw import Draw

widget = mo.ui.anywidget(Draw())
widget
# Fetch the doodle and put it in Python
widget.get_base64()
widget.get_pil()

Related project

This isn't the only tldraw integration with Python, you might also be interested in jupyter-tldraw. It's a neat project for sure, and the main difference is that this project tries to target marimo more directly and can also move a bit faster with that in mind. I'm currently employed at marimo, so having a tool that I can easily change is very useful.

Development

I am currently exploring how we might move some of these components to react, mainly in an attempt to keep things flexible in the future. There's no need to port everything just yet but I have ported the clipboard button. You should be able to develop it via:

make install
make dev

This assumes that you ran npm install beforehand.

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

modraw-0.1.12.tar.gz (589.9 kB view details)

Uploaded Source

Built Distribution

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

modraw-0.1.12-py3-none-any.whl (590.1 kB view details)

Uploaded Python 3

File details

Details for the file modraw-0.1.12.tar.gz.

File metadata

  • Download URL: modraw-0.1.12.tar.gz
  • Upload date:
  • Size: 589.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.7

File hashes

Hashes for modraw-0.1.12.tar.gz
Algorithm Hash digest
SHA256 0afdcac502cf27dbc8f0c0c4c88a9e292020eaf005606825e9e77738277fe394
MD5 64ee540bf5b624a8d0bc8f7d62d4db97
BLAKE2b-256 8e7f153395234a76dc4efe7b118ee6e904d25cbe4478d4d4010d4915e42895a6

See more details on using hashes here.

File details

Details for the file modraw-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: modraw-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 590.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.7

File hashes

Hashes for modraw-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 cc9f85520595c1ec1d204876c1d5cc1da16ff853b5bbd9ce0cd0d4c1012311a8
MD5 213dae077dde440b01004cf346668f22
BLAKE2b-256 8c432a439bdd8a956cb1a54daddb15aa0590b295f139f153412fcf258546479f

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