STOP HAND-WRITING GTK CODE?! LightGUI — 547 Widgets, Six Windows, and a Debugger That Watches Every Variable!

LightGUI is a C/C++ GUI designer for Linux with 547 hand-drawn widgets in 11 sections, a 583-entry palette, six separate windows, generated code with no .ui files, and a built-in GDB debugger — open source on GitHub.

STOP HAND-WRITING GTK CODE?! LightGUI — 547 Widgets, Six Windows, and a Debugger That Watches Every Variable!

There is a particular kind of C project that never gets started, and it is not the hard kind. It is the GUI kind. You know the algorithm, you know the data, you know exactly what the window should do — and then you face the toolkit: the boilerplate, the builder files, the signal wiring, the layout code you will write by hand and then rewrite when the window changes size. LightGUI is the answer to that project. It is a GUI designer for Linux that draws the window, generates the C++ code, builds it with CMake, and then steps through it with a built-in debugger — and it ships with 547 widgets ready to drop in.

LightGUI at work: the layout window, the widget palette, the Object Inspector, and the generated code — four of the six windows, live at once.

The count, stated straight

First, a correction, stated openly, because the numbers have moved and the old ones are still floating around. An earlier count said 194 widgets and a 230-entry palette. That was the state on November 26. It is wrong now. The real numbers, re-derived from the repository on November 29 and verified by the test suites, are 547 widgets and a 583-entry combined palette — 36 designer widgets plus all 547 library widgets. If you see 194 or 230 anywhere, that is the old count, not this build.

The 547 widgets live in 11 sections, and every widget belongs to exactly one section — that assignment is itself checked by an automated script, and it passes:

SectionWidgets
Windows & Dialogs28
Containers & Layout34
Buttons24
Display33
Text & Entry28
Choosers10
Views & Lists17
Menus & Toolbars16
Misc / X4
Stock Market287
Instrumentation66
Total547

The two big sections are the ones that turn LightGUI from a designer into a workbench. The Stock Market section is 287 widgets: charts, OHLC candles, indicators across momentum, trend and volatility, volume and comparison tools — every one hand-drawn, every one with a working code example. The Instrumentation section is 66 widgets: tanks that fill, gauges, switches that really toggle, lamps, and LED displays that spell words. The remaining nine sections are the everyday GUI toolkit — buttons, windows and dialogs, containers, display, text entry, choosers, views and lists, menus and toolbars, and the four oddballs in Misc / X. All 547 are drawn with raw X11 — no toolkit underneath them.

Six windows, each its own

LightGUI does not cram everything into one window with tabs. Under Xvfb it opens six distinct top-level windows, with no overlaps, each doing one job:

WindowSizeJob
Designer1150×720The main design surface: menus, toolbar, canvas
Widgets palette250×780The 36 designer widgets, grouped, Lazarus-dense
Object Inspector340×700Properties of the selected widget, in its own window
Code1000×700The generated C++ for your layout, live
Palette — 547 widgets380×880All 547 library widgets in 11 collapsible sections
Layout1024×720Your window, being built, widget by widget

The Object Inspector deserves its own paragraph, because it was a deliberate change, not an accident of layout. It used to share space with the layout window. It does not anymore. It is its own top-level window now, 340×700, sitting beside the layout instead of inside it — select a widget in the layout and the Inspector shows its geometry, its widget-specific properties, its events, and a colour palette, without covering the thing you are editing. That is the whole point of six windows: nothing you need is ever underneath something else you need.

The Widgets palette: the 36 designer widgets in grouped sections, two to a row, with the library sections below.

Drag, drop, generate — no .ui files

The workflow is the short version. Pick a widget from the palette, drop it on the layout canvas, set its properties in the Inspector, and LightGUI writes the C++ for you. The generated code is all code — there is no .ui file, no XML layout to keep in sync with the source, nothing that can drift. The Code window shows it as you work, and the build is CMake, so the project that comes out is a normal C++ project you can build, edit, and ship without LightGUI in the loop.

Every widget shares the same contract — the same constructor shape, the same way of being placed, drawn, and inspected — which is why the palette can hold 583 entries without turning into 583 special cases. Worked code examples ship in the docs for the widgets, and an automated doc-example verifier checks them, so the examples in the documentation are the ones that actually build.

A debugger that watches every variable

Generating code is only half the job; the other half is finding out why it does what it does. LightGUI has a GDB debugger built in: run, continue, step over, step into, step out, stop, restart, breakpoints with hit counts and conditions, a locals table, watch expressions, a call stack, and the target's stdout and stderr in the same window. It is the same debugger that the test suite exercises 46 times over — and all 46 checks pass.

The test numbers, measured not promised

LightGUI is built and tested on the machine it ships from, and the numbers below are the measured results of that run, not rates from a spec sheet. The build is clean — zero warnings, zero errors — and the binary is lightgui, 1,669,528 bytes.

SuiteResult
Palette self-test583 / 583
Debugger suite46 / 46
Palette window16 / 16
Palette icons13 / 13
Code windowALL PASS
Widget testsPASS
Placement547 / 547 placed, 547 / 547 drawn, 0 failures
Run matrix21 / 21
Icons parse as 16×16547 / 547
Seam test (make test)ALL PASS — 136 mapped, 411 unmapped, 34 designer types, geometry preserved

Read the last line carefully, because it is the honest caveat in the table. The seam test maps 136 of the 547 widgets to designer types; the other 411 have no direct designer-type mapping yet. They still place and draw — 547 out of 547 on both — but the mapping is incomplete, and the number is stated here so nobody has to discover it later.

Two bugs the tests actually caught

The icon count in that table — 547 out of 547 — was zero before the tests ran. Pillow writes 16-pixel ICO files with unpadded 2-byte AND-mask rows: 840 bytes where the spec says 872. Ubuntu 26.04's image loader rejects those files outright, so not one palette icon attached. The fix pads the mask rows and corrects the sizes after every save, and the pixel data is provably unchanged — the XOR pixels are identical on all 547 icons. The palette icons now load, and the test that proves it is in the table above.

The second bug was in a widget, not a tool. IndVortex had an off-by-one — it indexed series[k-1] with k equal to zero — which aborted the layout the moment the widget was placed. The placement test found it, because placement is exactly what the test does 547 times. It is fixed with a guard, in LightGUI only.

Two more honest notes from the same test run: a chart resize check raced the X server's configure event under Xvfb and passed only one run in three, so it now waits for the event with a bound instead of assuming it; and ImageMagick's compare tool changed its output format, which broke the integer comparisons in two palette test harnesses — a test-side fix, not an application bug. Nothing in either case was hidden to make a table look cleaner.

Get it

LightGUI is open source under the MIT license, on GitHub at github.com/cnmcdee/lightgui. Build it with make — that builds the designer and all 547 widget demos — and run ./lightgui. The docs in the repository cover all 11 sections, the six windows, the debugger, and the code generator, and the articles on this blog walk through the widget groups one section at a time. Start with the 287 Stock Market widgets or the 66 Instrumentation widgets if you want to see what the library can do before you draw your first button — and then draw the button. That is what it is for.

Linux Rocks Every Day