Four self-contained demos of the VMx Python library.
Generated architecture diagrams for all examples live in
../DIAGRAMS.md.
The console and tkinter examples share the root examples/python environment.
Each Textual example is a standalone uv project with its own environment and
lockfile, as shown in its section below.
cd examples/python
uv sync # prepares the console + tkinter environmentMinimal console demo. Demonstrates:
- Building a
ComponentVMOf[UserModel]with the fluent builder. - Subscribing to hub messages (
ConstructionStatusChangedMessage+PropertyChangedMessage). - The full lifecycle: construct → model mutations → destruct → dispose.
- The equality guard: setting the same model value emits no hub message.
Run:
Diagram:
python-console-hello-vmx.svg
(HTML,
PNG).
cd examples/python
uv run python -m hello_vmxExpected output (truncated):
=== hello_vmx ===
Building ComponentVMOf[UserModel] ...
vm.name = user-vm
vm.status = DESTRUCTED
vm.model = UserModel(name='Alice', age=30)
Calling construct() ...
[hub] user-vm status → CONSTRUCTING
...
vm.is_constructed = True
vm.modeled_hint = 'Alice (30)'
Mutating model → Bob, 25 ...
[hub] user-vm property 'model' changed
...
Setting the SAME model value (equality guard — no hub message expected) ...
=== Done ===
Full MVVM todo app using tkinter. Demonstrates:
TodoItemVM— subclassesComponentVMOf[TodoItem]; adds atoggle_doneRelayCommand.MainWindowViewModel— holds aCompositeVM[TodoItemVM]; exposesadd_commandandremove_command.MainWindow— pure view; all logic lives in the ViewModel.
Run (requires a display):
Diagram:
python-tk-todo-app.svg
(HTML,
PNG).
cd examples/python
uv run python -m todo_appHeadless import check:
cd examples/python
uv run python -c "from todo_app.__main__ import MainWindow; print('OK')"A general-purpose live inspector for any VMx hierarchy. Demonstrates:
vmx.tree.walkdriving atextual.widgets.Treeview of the VM hierarchy.- A
DataTablelog subscribed tohub.messages, showing everyPropertyChangedMessageandConstructionStatusChangedMessageas it fires. - Lifecycle keybindings (
cconstruct,ddestruct,rreconstruct,xdispose,sselect) on the highlighted node.
textual/inspector/ is its own uv project (Textual is a heavier dependency
than the other two examples) — run it from its own directory:
Diagram:
python-textual-inspector.svg
(HTML,
PNG).
uv run --project examples/python/textual/inspector python -m vmx_inspectorThe Notes Workspace flagship app — a TUI on Textual ≥ 0.80 that exercises
19 distinct VMx features in one cohesive scenario (notebooks tree,
paged + filterable notes list, FormVM editor, capability-aware action bar,
notifications, async lifecycle, dialogs, AggregateVM6 root, and the
v2.4.0 ThemeVM scenario contract, plus token-paged global search,
edit/preview state, and tag autocomplete). Pure-VM contract enforced; widget
classes expose only compose() / on_mount() / one-statement action_*().
textual/notes_showcase/ is its own uv project — run it from the repo root:
Diagram:
python-textual-notes-showcase.svg
(HTML,
PNG).
uv run --project examples/python/textual/notes_showcase python -m notes_showcaseSee textual/notes_showcase/README.md
for project layout, feature-traceability, and keybindings (Ctrl+S to save,
Ctrl+F to search, etc.). Cross-flavor parity is documented in
../notes-showcase-parity.md; the canonical
scenario contract lives at
../../spec/proposals/2026-05-29-notes-showcase-scenario.md.
examples/python/
├── pyproject.toml # shared deps (vmx local path via uv.sources)
├── README.md # this file
├── console/
│ └── hello_vmx/
│ ├── __init__.py
│ └── __main__.py # entry point: python -m hello_vmx
├── tk/
│ └── todo_app/
│ ├── __init__.py
│ └── __main__.py # entry point: python -m todo_app
└── textual/
├── inspector/ # stand-alone uv project (Textual)
│ ├── pyproject.toml
│ ├── README.md
│ ├── src/vmx_inspector/
│ └── tests/
└── notes_showcase/ # stand-alone uv project (Textual flagship)
├── pyproject.toml
├── README.md
├── src/notes_showcase/
└── tests/