Skip to content

SvgPanel

Front panel drawn in a vector editor: elements labelled awi:=;

SvgPanel, light theme SvgPanel, dark theme

Custom front panels · Widget catalog · API reference · schema svgpanel.schema.json

Example

The traits of the picture above:

ai.SvgPanel.template(
    "voltmeter",
    value={"value": 6.4},
    label="SvgPanel voltmeter",
    size=(220, 200),
)

Traits

Trait Type Default Set by Description
mode "control", "indicator" "control" host "control": the user sets the value; "indicator": display only.
size array [400,300] host [width, height] in CSS pixels.
svg string "" host SVG document. Python sanitizes it; the front end sanitizes it again (no scripts, event handlers or external resources). A role is read from the data-awi attribute of an element, else from its inkscape:label attribute.
value object {} host, widget Values of the bound names: numbers, texts, Booleans or null (shown as a dash). Written by the host, and by the operator through control roles in control mode; the kernel refuses a step value outside its limits.
problems array of string [] host Elements with an unknown role or an invalid option, as ': ' (IND-125). Computed by Python; without a kernel the front end shows its own list.
show_entries boolean true host Show an entry field for each value of a step control (IND-124).
Common traits (7), shared with other widgets
Trait Type Default Set by Description
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.