
Paint
by marimo team
A drawing and painting canvas widget for freeform input.
About this notebook
This notebook demonstrates the Paint widget from the wigglystuff library. The widget is a canvas that you draw on with your mouse. marimo wraps it with mo.ui.anywidget, so other cells can read the drawing as data. The mohtml library supplies Tailwind styles and small HTML helpers for the display cells.
When you draw on the canvas, marimo re-runs every cell that depends on the widget. One cell reads the drawing as a base64 string with get_base64 and places it in a styled HTML container. Another cell converts the drawing to a PIL image with get_pil, so you can process it with any Python imaging code.
A second Paint widget starts from an existing image, a thumbnail from the marimo blog, and you draw on that image instead of a blank canvas. The notebook notes that this can be useful when you work with multimodal LLMs.











