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.1.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.1-py3-none-any.whl (590.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: modraw-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f74f121aba8ce47e036989211b558f1124cc8b4ca7bda92fd1a9410023cfdcfc
MD5 cd784390ae9e75a12f998ed0198ca7fd
BLAKE2b-256 adc7585bf051d62b432307ba7985eb5fe8405e264e2abac96df69e2c66bd148d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: modraw-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf300f26f5a558595489436521a051c0fdb5e77270e6dda838b5aaadfbd52e42
MD5 59479dc3bc5f801bf0c624d1c60c9e77
BLAKE2b-256 82e137688cf7542a1744b5e258a9dd3ef300ebe061299d69a7db51e49e6b4482

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