.md →
CubeWidget API#
Bases: AnyWidget
Select a plane, line, and point by progressively locking cube axes.
Clicking an axis locks it and reveals a slider for its value. The first locked axis selects a plane, the second selects a line, and the third selects a point. Lock order is exposed so downstream code can preserve the same progressive slicing semantics.
Examples:
import marimo as mo
from wigglystuff import CubeWidget
cube = mo.ui.anywidget(
CubeWidget(
x_axis={"name": "Angle", "values": [0, 45, 90]},
y_axis={"name": "Force", "values": [0, 50, 100]},
z_axis={"name": "Time", "values": [0, 1, 2]},
)
)
cube
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_axis
|
dict[str, Any] | None
|
X-axis configuration with a display |
None
|
y_axis
|
dict[str, Any] | None
|
Y-axis configuration with a display |
None
|
z_axis
|
dict[str, Any] | None
|
Z-axis configuration with a display |
None
|
**kwargs
|
Any
|
Forwarded to |
{}
|
Source code in wigglystuff/cube_widget.py
lock_axis #
Lock an axis, optionally assigning its current value.
Source code in wigglystuff/cube_widget.py
reset #
unlock_axis #
Unlock an axis while preserving the order of the remaining axes.
Source code in wigglystuff/cube_widget.py
Synced traitlets#
| Traitlet | Type | Notes |
|---|---|---|
x_axis |
dict |
X-axis display name and numeric values. |
y_axis |
dict |
Y-axis display name and numeric values. |
z_axis |
dict |
Z-axis display name and numeric values. |
locked_order |
list[str] |
Axis keys in plane → line → point lock order. |
axis_values |
dict[str, float] |
Current value for each axis key. |
plane |
dict | None |
First locked axis display name and value. |
line |
dict | None |
Second locked axis display name and value. |
point |
dict | None |
Third locked axis display name and value. |
Helpers#
lock_axis(axis_key, value=None)locks an axis and optionally sets its value.unlock_axis(axis_key)removes an axis from the lock order.reset()clears every lock while preserving the current axis values.