Dear ImGui Bundle

repository·main·Indexed 23 days ago

https://github.com/pthom/imgui_bundle

A fast, feature-rich, cross-platform toolkit for C++ and Python that integrates over 23 libraries for plotting, text editing, node editing, and specialized UI widgets. It includes the imgui_terminal module for interactive terminal emulation via PTY, SSH, or WebSockets, and provides comprehensive Python bindings generated via litgen.

Tokens
56.3K
Snippets
125
Records
268
Agent score
77%

What's inside imgui-bundle

  1. Overview of C++ libraries and bindings in imgui_bundle

    main
    Dear ImGui Bundle integrates over 23 C++ libraries, each provided as a git submodule with auto-generated Python bindings. These libraries are categorized by their functional purpose, allowing developers to extend their applications with specialized tools for plotting, text editing, node editing, and more.
  2. Overview of ImGui Bundle + Pyodide for Browser-based Python GUIs

    main

    Combining ImGui Bundle with Pyodide allows you to run immediate-mode, stateful Python GUIs directly in the web browser. This stack provides a desktop-app feel (fast, fluid, interactive) without requiring a backend server, making it ideal for static web hosting.

    Key Characteristics

    • Immediate-mode GUI: Real-time, stateful UI without reactive graphs or notebook-style hacks.
    • Python-first: Write pure Python code using the same API available in C++, with seamless integration for libraries like NumPy, matplotlib, and OpenCV.
    • Zero Backend: Runs fully in the browser via WebAssembly (WASM). It is fully static, requiring only the serving of HTML, JS, and .wasm files.
    • High Customizability: Full control over render loops, input handling, docking, and theming.

    Ideal Use Cases

    • Dashboards: Financial visualizers, scientific dashboards with live plots, and AI/ML demos.
    • Simulations: Physics or math simulations requiring real-time interaction.
    • Education: Interactive teaching tools that require zero installation for students.
    • Data Exploration: Offline visual data explorers for research or labs.

    Limitations and Considerations

    • CORS: While it is a zero-backend solution, accessing external APIs may require a CORS-enabled proxy or a small backend to protect sensitive information like API keys.
  3. What is Dear ImGui Bundle?

    main

    Dear ImGui Bundle is a "batteries included" framework built on Dear ImGui. It bundles over 20 libraries for specialized tasks such as plotting, markdown rendering, node editors, and 3D gizmos. It is designed for building scientific tools, game tools, visualization applications, and developer tools.

    Key Characteristics:

    • Immediate Mode Paradigm: UI code is direct and readable. There are no widget trees, callbacks, or manual state synchronization required. What you write is what runs.
    • Cross-platform: Supports Windows, Linux, macOS, iOS, Android, and WebAssembly (via Emscripten or Pyodide).
    • Python-first: Provides full Python bindings with type hints and IDE autocompletion.
    • Up-to-date: Closely tracks Dear ImGui upstream with auto-generated Python bindings.
  4. Overview of ImGui Bundle key features

    main

    ImGui Bundle is a cross-platform ecosystem providing Immediate Mode GUI (IMGUI) capabilities for both C++ and Python.

    Key capabilities include:

    • Cross-platform support: Windows, Linux, macOS, iOS, Android, and WebAssembly.
    • Web deployment: Use C++ with Emscripten or Python with Pyodide to run full applications in the browser.
    • Python-first experience: High-quality Python bindings with type stubs for IDE autocompletion, allowing for standalone apps or interactive notebook UIs.
    • High performance: GPU-accelerated rendering (via OpenGL or other renderers) with minimal Python overhead (typically < 0.5ms per frame).
    • Synchronized APIs: Python bindings are auto-generated from C++, ensuring they stay in sync with Dear ImGui releases.
  5. Overview of the imgui_md fork in ImGui Bundle

    main

    ImGui Bundle uses an advanced, highly customized fork of imgui_md (originally by mekhontsev). This fork is designed to be more feature-rich and tightly integrated with the ImGui Bundle ecosystem while moving towards a more decoupled, pluggable architecture.

    Key advancements in this fork include:

    • Automatic font loading: Supports bold, italic, and code fonts.
    • Image support: Capability to load and display images within markdown.
    • LaTeX support: Integration for mathematical notation.
    • Expanded Markdown support: Enhanced support for various markdown blocks (e.g., admonitions, task lists, <details>, <summary>, and table cell alignment).
  6. Overview of Python binding generation scripts

    main

    The bindings_generation/ directory contains the automation infrastructure for creating Python bindings from C++ headers via litgen.

    Key components:

    • autogenerate_all.py: The script responsible for regenerating bindings across all libraries.
    • all_external_libraries.py: A registry containing information for all external libraries, including remotes, branches, and forks.
    • bundle_libs_tooling/: A collection of helper scripts for managing submodules.
    • bindings_generator_template/: A template used when adding a new library to the binding generation pipeline.
  7. Overview of Dear ImGui Bundle

    main

    Dear ImGui Bundle is a collection of libraries built around Dear ImGui for both C++ and Python. It is designed for rapid prototyping and tooling, providing a 'batteries included' ecosystem where various specialized libraries are pre-integrated to work together seamlessly.

    Key Capabilities:

    • Cross-platform support: Windows, macOS, Linux, iOS, Android, and WebAssembly.
    • Dual Language Support: Provides C++ and Python APIs with a very similar structure.
    • Integrated Ecosystem: Includes core widgets (Dear ImGui), 2D/3D plotting (ImPlot/ImPlot3D), image inspection (ImmVision), node editors, file dialogs, and more.
    • High-level Runners:
      • Hello ImGui: Manages windows, backends, docking, and assets.
      • ImmApp: Simplifies the activation of add-ons like ImPlot or Markdown.
    • Web Deployment: Supports C++ via Emscripten and Python via Pyodide (including deployable HTML templates).
  8. Overview of imgui_bundle CMake build infrastructure

    main

    The imgui_bundle_cmake directory contains CMake modules designed to build the imgui_bundle library and provide helper functions for downstream applications. It manages dependency resolution, module toggling, and simplifies the process of creating new applications using the bundle.

    Key components:

    • imgui_bundle_build_lib.cmake: Contains the main build logic, including dependency resolution and module toggling.
    • imgui_bundle_add_app.cmake: Provides the imgui_bundle_add_app() function to create an application with a single CMake call.
    • imgui_bundle_config.h: A C++ configuration header used to enable or disable specific modules via #define flags.
    • internal/: A collection of helpers for integrating individual libraries (e.g., add_imgui, add_hello_imgui).
  9. Identify the components of the Dear ImGui ecosystem

    main

    The project is built upon three core layers:

    1. Dear ImGui: A lightweight, fast C++ library for Immediate Mode GUI programming. It provides the core widgets (buttons, sliders, etc.) and leverages GPU rendering.
    2. Hello ImGui: A C++ wrapper around Dear ImGui that simplifies application setup, layout handling, FPS idling, and cross-platform (mobile/desktop) deployment.
    3. Dear ImGui Bundle: An extensive set of ready-to-use widgets and libraries built on top of ImGui and Hello ImGui. It provides high-level bindings for Python, allowing developers to create GUI applications using Python instead of C++.
  10. Explore the repository structure

    main

    The repository is organized into several key functional areas:

    • bindings/: Contains the Python package.
    • external/: Contains C++ libraries and their Python bindings. Each library typically includes a git submodule for the C++ source and a bindings/ folder containing litgen generation scripts and generated nanobind C++ code.
    • imgui_bundle_cmake/: Contains the build infrastructure, including main build logic, application creation helpers (imgui_bundle_add_app()), and configuration for various platforms (Pyodide, Conda, iOS).
    • docs/book/: The project documentation, structured as a Jupyter Book covering Python, C++, core libraries, add-ons, and developer guides.
  11. Compare ImGui Bundle with other Python GUI libraries

    main

    The sandbox/compare_other_libs directory contains a collection of simple demos designed to compare the performance, ease of use, and behavior of ImGui Bundle against other Python GUI libraries.

    Each demo is implemented within a single file and provides identical functionality across different libraries to ensure a fair and easy comparison.

  12. Understand the bindings_generation directory structure

    main

    The bindings_generation/ directory contains the core utilities and scripts used to automate the creation of C++ bindings and Python stubs for external libraries.

    Key components include:

    • all_external_libraries.py: The central registry of all bound libraries.
    • autogenerate_all.py: A script that triggers the generation of all C++ bindings, Python stubs, and the all_pybind_files.cmake file.
    • cpp/module.cpp: The main pybind11 module entry point.
    • cpp/pybind_imgui_bundle.cpp: A manual C++ file that aggregates all individual library modules into the main bundle.