.md →
Matrix API#
Bases: AnyWidget
Spreadsheet-like numeric editor with bounds, naming, and symmetry helpers.
Note
This widget has graduated to marimo core. If you are using marimo,
prefer marimo.ui.matrix.
Matrix will continue to work in plain Jupyter and other anywidget
hosts.
Examples:
import marimo as mo
from wigglystuff import Matrix
matrix = mo.ui.anywidget(Matrix(rows=3, cols=3, min_value=0, max_value=10))
matrix
Create a Matrix editor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
Optional[List[List[float]]]
|
Optional 2D list of initial values. |
None
|
rows
|
int
|
Number of rows when |
3
|
cols
|
int
|
Number of columns when |
3
|
min_value
|
float
|
Lower bound for cell values. |
-100
|
max_value
|
float
|
Upper bound for cell values. |
100
|
triangular
|
bool
|
If |
False
|
row_names
|
Optional[List[str]]
|
Custom labels for rows. |
None
|
col_names
|
Optional[List[str]]
|
Custom labels for columns. |
None
|
static
|
bool
|
Disable editing when |
False
|
flexible_cols
|
bool
|
Allow column count changes interactively. |
False
|
step
|
float
|
Increment step size for cell value adjustments. |
1.0
|
digits
|
int
|
Number of decimal digits to display. |
1
|
mirror
|
bool
|
If |
False
|
**kwargs
|
Any
|
Forwarded to |
{}
|
Source code in wigglystuff/matrix.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
Synced traitlets#
| Traitlet | Type | Notes |
|---|---|---|
matrix |
list[list[float]] |
Cell values. |
rows |
int |
Row count. |
cols |
int |
Column count. |
min_value |
float |
Minimum allowed value. |
max_value |
float |
Maximum allowed value. |
mirror |
bool |
Mirror edits across the diagonal when enabled. |
step |
float |
Step size for edits. |
digits |
int |
Decimal precision for display. |
row_names |
list[str] |
Optional row labels. |
col_names |
list[str] |
Optional column labels. |
static |
bool |
Disable editing when true. |
flexible_cols |
bool |
Allow column count changes interactively. |