XTachometer
XTachometer is a Monitor widget in LightGUI's XFrame widget set. Round tachometer: needle, redline zone, digital readout, peak hold.
XTachometer is the round dial: a needle over a scale, a redline zone at the top end, a digital readout of the current value, and a peak-hold marker. Set the maximum to match what you are measuring — RPM, percent, or anything else with a top end.

Key methods
set_value(v)— the current value; moves the needle and the readoutget_value()— the current valueset_max(m)— the value at the top of the dialget_max()— the current maximumset_redline(r)— where the red zone startsreset_peak()— drop the peak marker back to the current value
Every widget also gets the shared properties visible, enabled, bounds (x, y, width, height) and style_name, plus the background / foreground colours from the active style.
Example
Max and redline are yours to set — the dial, the digital readout and the peak marker follow.
XTachometer widget(display, screen, window, gc, &styles, 20, 20, 300, 300);
widget.set_max(100.0);
widget.set_redline(85.0);
widget.set_value(63.0);
widget.draw();The snippet above is the widget part only. As with every XFrame example, the full program opens a display, creates a window and a style manager, then runs the standard event loop — see the complete example in the repo.
Build it from the repo root:
g++ -std=c++17 -Iwidgets/components -Iwidgets examples/XTachometer.cpp -lX11 -o XTachometerRun it under Xvfb or a real X server; close the window to quit.
Example in the repo
The full working example is examples/XTachometer.cpp in the lightgui repo (C is canonical). The same widget is ported to the Rust and Python repos under the same name — see the links below.
Get the code
These widgets ship in all three LightGUI repos:
- lightgui (C)
- lightgui_rust (Rust)
- lightgui_python (Python)