High-FPS GPU immediate-mode UI for dashboards, live plots and scientific tools.
Dear PyGui is a fast, GPU-accelerated Python GUI framework built on Dear ImGui โ the immediate-mode UI library popular in game development and real-time tooling. Instead of retaining widget objects that persist across frames, immediate-mode GUIs rebuild the interface every frame. This sounds wasteful but is extremely efficient for dynamic, data-heavy interfaces that change constantly.
Dear PyGui excels where traditional retained-mode toolkits (tkinter, Qt) struggle: live plots updating at 60 FPS, node editors, debug overlays, and instrument dashboards.
dpg.create_context() initializes; dpg.destroy_context() cleans up.create_viewport() + show_viewport().dpg.window(), add_button(), add_plot() build the UI tree.callback parameter on widgets; dpg.set_frame_callback() for per-frame logic.| Feature | API |
|---|---|
| Line / scatter plots | dpg.add_plot(), add_line_series() |
| Node editor | dpg.add_node_editor() |
| Tables | dpg.add_table() |
| File dialogs | dpg.add_file_dialog() |
| Themes & styling | dpg.add_theme(), bind_theme() |
pip install dearpygui
# Requires Python 3.8+ and a GPU with OpenGL support
python -c "import dearpygui.dearpygui as dpg; print('OK')"
import dearpygui.dearpygui as dpg
dpg.create_context()
with dpg.window(label="Demo"):
dpg.add_text("Hello from Dear PyGui")
dpg.add_button(label="Click", callback=lambda: print("hi"))
dpg.create_viewport(title="Dear PyGui demo", width=400, height=200)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
import dearpygui.dearpygui as dpg
import math
dpg.create_context()
with dpg.window(label="Live sine wave"):
with dpg.plot(label="Plot", height=300, width=500):
dpg.add_plot_axis(dpg.mvXAxis, label="x")
y_axis = dpg.add_plot_axis(dpg.mvYAxis, label="y")
series = dpg.add_line_series([], [], parent=y_axis)
phase = [0.0]
def update():
phase[0] += 0.05
xs = [x/10 for x in range(628)]
ys = [math.sin(x/50 + phase[0]) for x in range(628)]
dpg.set_value(series, [xs, ys])
dpg.set_frame_callback(1, lambda: dpg.set_frame_callback(dpg.get_frame_count()+1, update) or update())
dpg.create_viewport(title="Plot", width=550, height=400)
dpg.setup_dearpygui(); dpg.show_viewport(); dpg.start_dearpygui(); dpg.destroy_context()
dpg.add_table() for large data grids with sorting and scrolling.You need live data visualization, instrument panels, or debug overlays that update at high frame rates. Not for traditional desktop applications with menus and forms.
Useful guides and tools (from webpage_links.xlsx).