Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Hello ImGui

Hello ImGui: the app runner. It creates the window and the rendering backend, and runs the loop, on desktop, mobile and the web.

Around Dear ImGui, it adds what an app needs: dockable windows and layouts, a menu and a status bar, fonts and icons, assets, DPI awareness, themes, power saving when idle, and the user’s settings.

Start with hello_imgui.run(gui_function); for more control, fill a RunnerParams. immapp.run does the same, and also sets up the add-ons (ImPlot, markdown, the node editor...): most apps of the bundle use it. Docs: https://pthom.github.io/hello_imgui/book/

Upstream repository · The book’s page

Modules

In imgui_bundle (from imgui_bundle import hello_imgui):

Demos using it

The demos of the catalog that use it (the pictures link to their code and to the playground).

Assets and add-ons

Assets and add-ons

Load images and icons from your assets folder, and use two add-ons: markdown and ImPlot.

More

A markdown editor with a live preview, and a pie chart whose values you can drag. Tick More info under each part to see how it is done. The add-ons are activated with immapp.AddOnsParams.

Uses: ImPlot

Python: ▶︎ Run · Code
C++: ▶︎ Run · Code

Dockable windows

Dockable windows

Hello ImGui provides a docking system: define named dock spaces, then assign windows to them.

More

Windows can be dragged, tabbed, and rearranged by the user.

Python: ▶︎ Run · Code
C++: ▶︎ Run · Code

A full app: docking, fonts, logs

A full app: docking, fonts, logs

A template for a real application, built with Hello ImGui: copy it and start from there.

More

Dockable windows with several layouts, colored fonts and emojis, a log window, a status bar, toolbars, menus and a theme chooser. Your settings are saved, and restored at the next start. The code is heavily commented.

Python: ▶︎ Run · Code
C++: ▶︎ Run · Code

Custom 3D background (OpenGL)

Custom 3D background (OpenGL)

Draw anything behind your GUI with OpenGL: here, an animated sea whose waves and colors you can tune.

More

The Seascape shader is by Alexander Alekseev (TDM, 2014). Hello ImGui calls runner_params.callbacks.custom_background at each frame, before the GUI: that is where it draws, with OpenGL (PyOpenGL in Python).

Desktop only

Uses: OpenGL

Python: Code
C++: ▶︎ Run · Code

Power save when idle

Power save when idle

When nothing happens, Hello ImGui lowers the frame rate to spare the CPU: watch the FPS and the spinner slow down.

More

Move the mouse, and they speed up again. The slider sets fps_idle (0 means full speed), and the checkbox turns idling off, for example during an animation.

Uses: spinners

Python: ▶︎ Run · Code
C++: ▶︎ Run · Code

Chinese and other non-Latin fonts

Chinese and other non-Latin fonts

The bundled fonts cover Latin, Greek and Cyrillic only: other scripts show up as ???.

More

The fix: load a font that has the glyphs you need, first, so that it becomes the default font. This demo shows how, with Noto Sans SC: download it, and the demo’s sample lines come alive.

Desktop only

Python: Code
C++: ▶︎ Run · Code

Command palette

Command palette

A searchable list of commands, as in VS Code: press Ctrl+Shift+P (Cmd+Shift+P on macOS).

More

Type a few letters to filter it. One command changes the theme in two steps, another writes to the log below. Learn how to register commands and their callbacks with imgui-command-palette.

Uses: command palette

Python: ▶︎ Run · Code
C++: ▶︎ Run · Code

Test engine

Test engine

Three windows: the Dear ImGui demo, the ImGui Test Engine panel, and a few buttons that run tests.

More

Watch a test drive the mouse and the keyboard: it opens tree nodes, clicks buttons, types text, and checks the results. See the test engine doc.

Desktop only

Python: Code
C++: ▶︎ Run · Code

Themes and theme tweaking

Themes and theme tweaking

Pick a complete look for your app, then fine-tune its colors, rounding and spacing.

More

The complete looks come from Hello ImGui.

Python: ▶︎ Run · Code

Log window

Log window

A log window for your app, with four levels: debug, info, warning and error.

More

Call hello_imgui.log() anywhere, and show the window with hello_imgui.log_gui(). Its colors follow the theme. Adapted from ImGuiAl.

Python: ▶︎ Run · Code
C++: ▶︎ Run · Code

Run code alongside the GUI (async)

Run code alongside the GUI (async)

The GUI runs as an asyncio task, while a Python loop keeps computing.

More

The window shows both rates: the GUI’s frames per second, and the loop’s computations per second. The loop yields with await asyncio.sleep(0) to share the event loop. See async support.

Desktop only

Python: Code