ImGui Toggle: toggle switches, an alternative to checkboxes, with several styles and an optional animation.
toggle(label, value) returns (changed, new_value); a ToggleConfig sets its look.
Upstream repository · The book’s page
Modules¶
In imgui_bundle (from imgui_bundle import imgui_toggle):
imgui_toggle: 9 functions, 5 classes, 2 enums · the C++ view
Demos using it¶
The demos of the catalog that use it (the pictures link to their code and to the playground).

Double pendulum¶
A double pendulum is a chaotic system: tiny changes in its initial conditions lead to wildly different trajectories.
More
Drag the angles to set initial positions, then release and watch chaos unfold.
Uses: ImPlot, knobs, toggles

Fourier epicycles¶
Any closed curve can be approximated by a sum of rotating circles (a Fourier series).
More
Adjust the number of circles to see how the approximation improves.
Uses: ImPlot, knobs, toggles

Logistic map¶
A very simple equation, and yet it can lead to wildly different behaviors, up to chaos.
More
The logistic map, x(n+1) = r * x(n) * (1 - x(n)), models for example the growth of a population with limited resources. Depending on r, it is stable, periodic (in 2-cycles, 4-cycles, etc), or chaotic. Let’s explore this.
Uses: ImPlot, toggles

Gravitational lensing: a ring, arcs, the Einstein Cross¶
A mass in the foreground bends the light of a galaxy behind it.
More
The left sky shows the galaxy as it is, the right one what we see through the lens. Drag the galaxy (yellow) and the lens (blue), turn the knobs, or start from a preset: an Einstein ring, two images, a giant arc, the Einstein Cross. The thin lines are the critical curve, where the magnification diverges, and its map in the source plane, the caustic: as the galaxy crosses it, images are born or merge. Hover a pixel of the observed sky to see where its light comes from.
Uses: ImPlot, knobs, toggles

Power save when idle¶
When nothing happens, Hello ImGui lowers the frame rate to spare the CPU: after 3 seconds, the live plot and the spinner become choppy.
More
Content that changes on its own says so with hello_imgui.set_item_is_live(), and keeps the full speed while it is visible. The idling settings are global.
Uses: ImPlot, toggles, spinners

Knobs, toggles, spinners and more¶
Knobs, toggle switches, spinners, a command palette, a dock-like cool bar: widgets beyond Dear ImGui’s own.
More
They come from the libraries in the bundle: imgui-knobs, imgui_toggle, imspinner, imgui
Uses: knobs, toggles, spinners, cool bar, command palette, file dialogs

