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.

ImmApp

ImmApp: runs an app in one call, with the bundle’s add-ons set up: ImPlot, ImPlot3D, markdown, LaTeX, the node editor, ImAnim.

immapp.run(gui_function, window_title="My app", with_implot=True) is the usual way to start an app of the bundle; AddOnsParams lists the add-ons. It relies on Hello ImGui: a hello_imgui.RunnerParams gives full control over the window, the docking and the callbacks.

It also holds helpers: sizes in em units (em_size, em_to_vec2), a render loop driven by the app (manual_render), plots and widgets inside the node editor, and the code utilities of the demos.

Upstream repository · The book’s page

Modules

In imgui_bundle (from imgui_bundle import immapp):

Demos using it

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

What is an Immediate GUI

What is an Immediate GUI

With Dear ImGui, your GUI code is simple and direct: no widget trees, no callbacks, no state synchronization.

More

You call functions to create widgets, and they return the current value. That’s it.

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

Hello world, in two lines

Hello world, in two lines

ImmApp opens the window, runs the loop, and calls your GUI function at every frame: immapp.run(gui) is all it takes.

More

Add widgets to that function, and you have an app. The C++ version is three lines.

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

A parametric curve

A parametric curve

Turn the knobs, or click Random: the curve follows at once.

More

At every frame, the GUI function draws the plot with ImPlot and the knobs with imgui-knobs, and reads their values right there. No callbacks, no widget objects: that is the immediate mode.

Uses: ImPlot, knobs

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

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

Drive an app, capture screenshots

Drive an app, capture screenshots

A test function drives the app: it clicks, moves a slider, opens a header, and takes a screenshot at each step.

More

immapp.testing.run() starts the app, runs the test function, then exits. Handy for automated checks and for documentation pictures. See the test engine doc.

Desktop only

Python: Code
C++: Code

Knobs, toggles, spinners and more

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-command-palette and ImCoolBar. Also file dialogs: the native ones (portable-file-dialogs), and ImFileDialog, drawn with ImGui.

Uses: knobs, toggles, spinners, cool bar, command palette, file dialogs

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

Context managers (imgui_ctx)

Context managers (imgui_ctx)

In Python, with imgui_ctx.begin("Window"): replaces a begin() / end() pair, and the end() can no longer be forgotten.

More

The same exists for child windows, menus, popups, tables, tabs, fonts and styles, and for ImPlot with implot_ctx. Open a section to try it and read its code. See the Python tips.

Uses: ImPlot

Python: ▶︎ 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