Files
lightgui_python/examples
Muse 81a9693d71 Fix monitor-widget proportions: dynamic graph margins, scaled fonts, tach numerals
- Graphs (History/Net/Temp): dynamic left margin from the widest Y
  label (fixes Y labels overflowing the plot), legend on top, 5 Y
  labels, humanised units in NetGraph, TempHistory threshold label
  above the line ("80 C limit"), top/bottom Y labels hang clear of
  the title and the strip below the plot. History gains -60s/now.
- XTachometer: numerals 7.5% of dial diameter bold just inside the
  tick ring, RPM bold centred in-dial below the top numerals (its
  baseline hangs below the top numeral so it cannot collide with
  the 3200/4800 numerals on small dials), readout "value (peak N)"
  enlarged below the hub, redline numerals in red.
- All 14 audit widgets: font sizes derived from widget dimensions
  per the proportions audit (titles 16px bold, hero values 24-48px
  bold, body/legend 13-16px, min 11px); CoreGrid keeps 4x2; UsageBar
  labels outside the bar on a dark panel; StackBar title+total
  header (adaptive: omitted at 48px where it would push the legend
  out) with centred block; VerticalBar value inside the bar, peak
  label with shrink-to-fit; ArcGauge centre 40-48px + endpoints;
  DonutGauge centre 36-44px, ring 8-10% of diameter, duplicate
  title dropped, centre label is the value name; ProcessList 13px
  rows, bold header with sort indicator, "N procs"; LoadBadge
  centred two-line block with scaled values; MonitorButton scaled
  label/dot/status + detail line; MonitorGrid ceil(sqrt(n)) columns,
  name+status+detail design with wrapped detail; SysBox hero
  28-32px + max + bar %.
- New _fpx() clamp helper; XStackBar gains the "unit" prop
  (props_monitor.py) for its "total <sum> <unit>" header.
- Demos: button/grid labels "SSH :22" -> "sshd :22", tach label
  "Engine" -> "RPM", stackbar demo 320x48 -> 320x120 (title+bar+
  legend cannot fit in 48px), verticalbar demo 60 -> 160 wide
  (the "peak 82" label cannot fit in a 60px widget).
- Deviations from the audit spec: UsageBar label capped at 40px
  (the literal 0.45x rule gives 209px in a 464px-tall bar); SysBox
  hero uses 10% of height clamped 20-32px (spec 6-7% conflicts
  with the audited-correct PY value of 10.3%); PY LoadBadge gets
  no 1/5/15 sub-labels (the audit calls the PY layout correct;
  the sub-labels were directed at Rust).
Full suite: 363 tests OK (44 skipped). All 15 demos shot + verified.
2026-12-05 21:32:36 +00:00
..

LightGUI Python widget examples

One minimal complete program per widget in the LightGUI Python set (562 widgets: 209 XFrame + 287 Stock + 66 Instrumentation).

Each file is the LightGUI designer's own Python codegen output for a project holding just that widget: one window, the widget placed at its default size, OnClick wired to a handler that prints EVENT <name> OnClick. Some widgets get a seeded demo prop so the screenshot shows something (a gauge gets value 65, a combo box gets three items, a stock chart gets symbol AAPL); charts and indicators render the built-in deterministic demo price series. The 15 X* monitor examples also run a GLib timer that feeds live data (sine waves, or real /proc + systemctl + socket checks for the process / load / monitor widgets) and redraws; their screenshots live in examples/shots/ (taken with tools/shoot_monitor.py).

Run one

PYTHONPATH=/opt/lightgui_python python3 examples/gtkbutton.py

From a checkout of this repo, PYTHONPATH is the repo root (the directory holding the lightgui package). You need a display; under Xvfb:

DISPLAY=:99 python3 examples/gtkbutton.py

How they were made

Generated by /opt/lightgui-docs/pythondoc/drive.py on the docs server: drive.py gen all writes these files from lightgui.model.Project + lightgui.generator.generate, and drive.py shot all runs each one under Xvfb and screenshots it. The screenshots appear on the widget pages at https://pythondoc.lightgui.com/.

Regenerate

python3 /opt/lightgui-docs/pythondoc/drive.py gen all
python3 /opt/lightgui-docs/pythondoc/drive.py shot all --workers=6