Files

Network Monitor — monitor (Python)

A live network monitor in one 1024x768 window, built only from the LightGUI XFrame monitor widgets (Stage 2 of the btop-widget project).

What it shows

Live traffic for the main interface (enp3s0 on hot_dallas, otherwise the first non-loopback interface with traffic), read from /proc/net/dev and differenced once a second:

  • XNetGraph (top) — up/down graph in bytes/s, current rates plus session totals in the legend.
  • XSysBox (middle, x2) — Download / Upload big-number boxes in KiB/s, each with its own history sparkline and usage bar. The range tracks the session peak (x1.15, floor 100 KiB/s).
  • XHistoryGraph — down/up rate history in KiB/s, 60 s window, current / min / max / average per series.
  • XUsageBar (bottom) — total throughput as a percentage of the link speed (from /sys/class/net/<iface>/speed, 1 Gb/s fallback).

Live data, not demo data

The widgets draw deterministic demo data until live samples are pushed; push() / push_net() start a fresh live series (the demo is never extended), so everything on screen after the first tick is measured traffic. The 1 s tick matches push_net(), which accumulates one second of totals per push.

Run

PYTHONPATH=. python3 examples/monitor_network_monitor/main.py
# quit by closing the window

Tests

DISPLAY=:99 python3 -m unittest discover -s tests

Source

  • C: examples/monitor/network-monitor/main.cpp in lightgui
  • Rust: crates/xframe-demo/examples/monitor_network_monitor/main.rs in lightgui_rust
  • Python: examples/monitor_network_monitor/main.py in lightgui_python