Skip to content

PictureControl

Drawing surface driven by the host with drawing commands (SPEC-005 .. SPEC-007).

PictureControl, light theme PictureControl, dark theme

Graphs, specialized · Widget catalog · API reference · schema picture.schema.json

Example

The traits of the picture above:

ai.PictureControl(label="PictureControl", mode="indicator")

The data of the picture (samples, history or drawing) is sent with the widget's methods, not as traits: see the widget catalog.

Traits

Trait Type Default Set by Description
size array [320,200] host [width, height] in CSS pixels.
value object {} derived Last click {x, y, button} in CSS pixels from the top-left corner (SPEC-006), control mode only. Written by the host when it owns the state; without one, the front end writes it back (HOST-012). The click is always sent as a click message.
background string "" host CSS color of the background; empty: transparent.
Common traits (8), shared with other widgets
Trait Type Default Set by Description
mode "control", "indicator" "control" host "control": the user sets the value; "indicator": display only.
label string "" host Plain text, never interpreted as HTML (SEC-002).
disabled boolean false host Greyed out, input rejected.
visible boolean true host
tooltip string "" host Plain text shown on hover.
style "modern", "classic", "system" "modern" host
theme "auto", "light", "dark", "system" "auto" host "auto": the style decides; "system": the host page or the operating system (STYLE-007).
skin object {} host Replaceable drawing parts: part name -> SVG source, sanitized (STYLE-005, STYLE-006).

Set by: host, the program (Python, Julia, ...); widget, the user through the widget; derived, computed from other traits by the host that owns the state, or by the widget. See the trait contract.