Skip to main content

Tldraw for Jupyter

Project description

Jupyter Tldraw

PyPI version

A tldraw whiteboard as a Jupyter widget, built with anywidget.

image

Install & run

uv run --with jupyterlab --with tldraw jupyter lab

Examples

Three example notebooks are included:

Notebook Widget What it shows
basic.ipynb TldrawWidget A plain tldraw canvas embedded in a cell.
monkey.ipynb MonkeyWidget A 🐒 emoji on the canvas; its x / y are synced as traitlets, so you can .observe(...) the position from Python.
stroke.ipynb StrokeWidget Captures the currently-drawn freehand stroke as a [[x, y], ...] list in Python via the stroke traitlet.

Minimal usage:

from tldraw import TldrawWidget
t = TldrawWidget()
t

Developer setup

  1. Clone the repo
  2. npm i
  3. uv sync
  4. npm run dev (esbuild watches js/*.jsx and rebuilds bundles into src/tldraw/static/)
  5. uv run jupyter lab

Hot module reload

Put this at the top of any dev notebook, before importing the widget:

%env ANYWIDGET_HMR=1
%load_ext autoreload
%autoreload 2

ANYWIDGET_HMR=1 makes anywidget watch the _esm / _css files; %autoreload 2 does the same on the Python side. Combined with npm run dev, edits to js/*.jsx swap into the running widget without re-running the cell.

anywidget reads ANYWIDGET_HMR at import time — if you forgot to set it first, restart the kernel once.

In marimo

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

tldraw-5.1.1.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

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

tldraw-5.1.1-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

Details for the file tldraw-5.1.1.tar.gz.

File metadata

  • Download URL: tldraw-5.1.1.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tldraw-5.1.1.tar.gz
Algorithm Hash digest
SHA256 d964142b8bca3b6aed2358338105bacb7e580509764998dee6e1ce5e000643e8
MD5 11d5d50f88210bbef1a88b0c46c5388f
BLAKE2b-256 c32446a9d455f49ea187e1acfbe186aa239a067125362de6a312be9ccc2d00a7

See more details on using hashes here.

File details

Details for the file tldraw-5.1.1-py3-none-any.whl.

File metadata

  • Download URL: tldraw-5.1.1-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tldraw-5.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87a6e20487e19afaac9840bddb10cb22cfc0c37b28b1a4d84b5d6f5ada91f444
MD5 8983e347cc57d5b0f97d483fe151dd50
BLAKE2b-256 7152cc277ed9e873f6ceb6058705e898b614d3427d7e2c3bfbbcf6b0a9f3c9a2

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