Control Widgets¶
CheckBox¶
Checkbox with label.
Constructor: new Widgets.CheckBox(text)
Methods:
Method |
Description |
|---|---|
|
Set checked state. |
|
Return checked state. |
Callbacks:
activated– fired when state changes.
let cb = new Widgets.CheckBox("Enable notifications");
cb.add_callback('activated', (w) => {
console.log("Checked:", w.get_state());
});
ComboBox¶
Dropdown with optional editable text, filtering, and scroll limit.
Constructor: new Widgets.ComboBox({editable, dropdown_limit})
Options:
editable– allow typing in the text fielddropdown_limit– max visible items before scrolling
Methods:
Method |
Description |
|---|---|
|
Add an item to the end. |
|
Insert item in alphabetical order. |
|
Remove item by text. |
|
Set current text/selection. |
|
Return current text. |
|
Select item by index. |
|
Return selected index. |
|
Return text at index. |
|
Remove all items. |
|
Set display width in characters. |
Callbacks:
activated– fired when selection changes.
let combo = new Widgets.ComboBox({editable: false});
combo.append_text("Option A");
combo.append_text("Option B");
combo.set_index(0);
combo.add_callback('activated', (w) => {
console.log("Selected:", w.get_text());
});
Slider¶
Range slider (integer or float).
Constructor: new Widgets.Slider({orientation, track, dtype, min, max, step, value, show_value})
Options:
orientation–"horizontal"or"vertical"track– continuous tracking while draggingdtype–"int"or"float"min,max,step– range limits and step sizevalue– initial valueshow_value– display the current value
Methods:
Method |
Description |
|---|---|
|
Set current value. |
|
Return current value. |
|
Set range and step. |
|
Enable/disable continuous tracking. |
Callbacks:
activated– fired when value changes.
let slider = new Widgets.Slider({min: 0, max: 100, value: 50});
slider.add_callback('activated', (w) => {
console.log("Value:", w.get_value());
});
SpinBox¶
Numeric input with increment/decrement buttons.
Constructor: new Widgets.SpinBox({dtype, min, max, step, value, decimals})
Options:
dtype–"int"or"float"min,max,step– range limits and step sizevalue– initial valuedecimals– decimal places to display
Methods:
Method |
Description |
|---|---|
|
Set current value. |
|
Return current value. |
|
Set range and step. |
|
Set decimal places. |
Callbacks:
activated– fired when value changes.
Dial¶
Rotary knob control.
Constructor: new Widgets.Dial({track, dtype, min, max, step, value})
Options:
track– continuous tracking while draggingdtype–"int"or"float"min,max,step– range limits and step sizevalue– initial value
Methods:
Method |
Description |
|---|---|
|
Set current value. |
|
Return current value. |
|
Set range and step. |
|
Enable/disable continuous tracking. |
|
Set knob diameter in pixels. |
|
Set a custom icon on the knob. |
Callbacks:
activated– fired when value changes.
ScrollBar¶
Standalone scrollbar with draggable thumb.
Constructor: new Widgets.ScrollBar({orientation, thickness})
Options:
orientation–"horizontal"or"vertical"thickness– scrollbar thickness in pixels
Methods:
Method |
Description |
|---|---|
|
Set scroll position (0–1). |
|
Return scroll position. |
|
Set thumb width as fraction (0–1). |
Callbacks:
activated– fired when scroll position changes.
ProgressBar¶
Determinate progress indicator.
Constructor: new Widgets.ProgressBar()
Methods:
Method |
Description |
|---|---|
|
Set progress (0–1). |
|
Return current progress. |
Callbacks: None.
let progress = new Widgets.ProgressBar();
progress.set_value(0.75); // 75%