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.

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.0.0.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.0.0-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tldraw-5.0.0.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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.0.0.tar.gz
Algorithm Hash digest
SHA256 3198ba6b02930373678573c2393f56f0907ce165adbf07690dc684d88670e88e
MD5 ec8722f67a22fee4106d2fb2cab897ad
BLAKE2b-256 83fd196b915ce8b7feb776877a40ff56aed4cc09cbd15c171dccd805b7f28b52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tldraw-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33d96129bbac87a44d5c9776adafdb230009a661a1ef856819b231484b22a605
MD5 45cec56c0bcab25a94e1fb4c91670337
BLAKE2b-256 ed2eff70e67749531ab54307a8f79496c241867aa7cd8bfcca94835f5eff0fd9

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