Coder Social home page Coder Social logo

pthom / imgui_bundle Goto Github PK

View Code? Open in Web Editor NEW
630.0 14.0 63.0 34.6 MB

Dear ImGui Bundle: an extensive set of Ready-to-use widgets and libraries, based on ImGui. Start your first app in 5 lines of code, or less. Whether you prefer Python or C++, this pack has your back!

Home Page: https://pthom.github.io/imgui_bundle/

License: MIT License

CMake 1.69% Python 72.69% C++ 8.94% Shell 0.08% Jupyter Notebook 14.67% C 1.03% HTML 0.47% JavaScript 0.40% Dockerfile 0.04%
cpp imgui python3 creative-coding immediate-gui jupyter-notebook research-and-development

imgui_bundle's People

Contributors

aman-anas avatar andreondra avatar dcnieho avatar dependabot[bot] avatar district10 avatar hugle avatar jc211 avatar learn-more avatar nick-0 avatar pthom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imgui_bundle's Issues

Installation fails on python 3.12 (pre-release)

Initially i ran into PyGLM failing to install but after seeing it's apparently only used in one imgui-bundle demo, i tried removing it from setup.py but now building wheels for imgui-bundle fails.
(maybe because i removed it, i'm not familiar with building packages)
Python version: 3.12.0rc3

Log:

PS E:\SoS-TAS> pip install git+https://github.com/shenef/imgui_bundle.git
Collecting git+https://github.com/shenef/imgui_bundle.git
  Cloning https://github.com/shenef/imgui_bundle.git to c:\users\shen\appdata\local\temp\pip-req-build-b8604ehv
  Running command git clone --filter=blob:none --quiet https://github.com/shenef/imgui_bundle.git 'C:\Users\shen\AppData\Local\Temp\pip-req-build-b8604ehv'
  Resolved https://github.com/shenef/imgui_bundle.git to commit 37380db6c53953f6807e27e5713aff1389b140dd
  Running command git submodule update --init --recursive -q
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.15 in c:\users\shen\appdata\local\programs\python\python312\lib\site-packages (from imgui-bundle==0.8.8) (1.26.0rc1)
Collecting munch>=2.0.0 (from imgui-bundle==0.8.8)
  Obtaining dependency information for munch>=2.0.0 from https://files.pythonhosted.org/packages/56/b3/7c69b37f03260a061883bec0e7b05be7117c1b1c85f5212c72c8c2bc3c8c/munch-4.0.0-py2.py3-none-any.whl.metadata
  Using cached munch-4.0.0-py2.py3-none-any.whl.metadata (5.9 kB)
Requirement already satisfied: glfw>2.5 in c:\users\shen\appdata\local\programs\python\python312\lib\site-packages (from imgui-bundle==0.8.8) (2.6.2)
Requirement already satisfied: PyOpenGL>=3.0 in c:\users\shen\appdata\local\programs\python\python312\lib\site-packages (from imgui-bundle==0.8.8) (3.1.7)
Collecting pillow>=9.0.0 (from imgui-bundle==0.8.8)
  Obtaining dependency information for pillow>=9.0.0 from https://files.pythonhosted.org/packages/00/00/d42abea0b4a415ea1e0975c981f95f354de1280d7e7bef3882bf1464b795/Pillow-10.0.1-cp312-cp312-win_amd64.whl.metadata
  Downloading Pillow-10.0.1-cp312-cp312-win_amd64.whl.metadata (9.6 kB)
Downloading munch-4.0.0-py2.py3-none-any.whl (9.9 kB)
Downloading Pillow-10.0.1-cp312-cp312-win_amd64.whl (2.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 MB 7.6 MB/s eta 0:00:00
Building wheels for collected packages: imgui-bundle
  Building wheel for imgui-bundle (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for imgui-bundle (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [355 lines of output]


      --------------------------------------------------------------------------------
      -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.


      -- The C compiler identification is MSVC 19.36.32535.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- The CXX compiler identification is MSVC 19.36.32535.0
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Configuring done (2.8s)
      -- Generating done (0.0s)
      -- Build files have been written to: C:/Users/shen/AppData/Local/Temp/pip-req-build-b8604ehv/_cmake_test_compile/build
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator - success
      --------------------------------------------------------------------------------

      Configuring Project
        Working directory:
          C:\Users\shen\AppData\Local\Temp\pip-req-build-b8604ehv\_skbuild\win-amd64-3.12\cmake-build
        Command:
          'C:\Users\shen\AppData\Local\Temp\pip-build-env-j79e7p0d\overlay\Lib\site-packages\cmake\data\bin/cmake.exe' 'C:\Users\shen\AppData\Local\Temp\pip-req-build-b8604ehv' -G Ninja -D_SKBUILD_FORCE_MSVC=1930 --no-warn-unused-cli '-DCMAKE_INSTALL_PREFIX:PATH=C:\Users\shen\AppData\Local\Temp\pip-req-build-b8604ehv\_skbuild\win-amd64-3.12\cmake-install\bindings\imgui_bundle' -DPYTHON_VERSION_STRING:STRING=3.12.0rc3 -DSKBUILD:INTERNAL=TRUE '-DCMAKE_MODULE_PATH:PATH=C:\Users\shen\AppData\Local\Temp\pip-build-env-j79e7p0d\overlay\Lib\site-packages\skbuild\resources\cmake' '-DPYTHON_EXECUTABLE:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\python.exe' '-DPYTHON_INCLUDE_DIR:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\Include' '-DPYTHON_LIBRARY:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\libs\python312.lib' '-DPython_EXECUTABLE:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\python.exe' '-DPython_ROOT_DIR:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312' -DPython_FIND_REGISTRY:STRING=NEVER '-DPython_INCLUDE_DIR:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\Include' '-DPython_LIBRARY:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\libs\python312.lib' '-DPython3_EXECUTABLE:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\python.exe' '-DPython3_ROOT_DIR:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312' -DPython3_FIND_REGISTRY:STRING=NEVER '-DPython3_INCLUDE_DIR:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\Include' '-DPython3_LIBRARY:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\libs\python312.lib' -DCMAKE_BUILD_TYPE:STRING=Release

      Not searching for unused variables given on the command line.
      -- The C compiler identification is MSVC 19.36.32535.0
      -- The CXX compiler identification is MSVC 19.36.32535.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      'C:/Users/shen/AppData/Local/Programs/Python/Python312/python.exe' '-c' 'import pybind11; print(pybind11.get_cmake_dir())'
      CMake Warning (dev) at C:/Users/shen/AppData/Local/Temp/pip-build-env-j79e7p0d/overlay/Lib/site-packages/pybind11/share/cmake/pybind11/FindPythonLibsNew.cmake:98 (find_package):
        Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
        are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
        the cmake_policy command to set the policy and suppress this warning.

      Call Stack (most recent call first):
        C:/Users/shen/AppData/Local/Temp/pip-build-env-j79e7p0d/overlay/Lib/site-packages/pybind11/share/cmake/pybind11/pybind11Tools.cmake:50 (find_package)
        C:/Users/shen/AppData/Local/Temp/pip-build-env-j79e7p0d/overlay/Lib/site-packages/pybind11/share/cmake/pybind11/pybind11Common.cmake:188 (include)
        C:/Users/shen/AppData/Local/Temp/pip-build-env-j79e7p0d/overlay/Lib/site-packages/pybind11/share/cmake/pybind11/pybind11Config.cmake:250 (include)
        cmake/find_pybind11.cmake:20 (find_package)
        CMakeLists.txt:132 (find_pybind11)
      This warning is for project developers.  Use -Wno-dev to suppress it.

      -- Found PythonInterp: C:/Users/shen/AppData/Local/Programs/Python/Python312/python.exe (found suitable version "3.12", minimum required is "3.6")
      -- Found PythonLibs: C:/Users/shen/AppData/Local/Programs/Python/Python312/libs/python312.lib
      -- Performing Test HAS_MSVC_GL_LTCG
      -- Performing Test HAS_MSVC_GL_LTCG - Success
      -- Found pybind11: C:/Users/shen/AppData/Local/Temp/pip-build-env-j79e7p0d/overlay/Lib/site-packages/pybind11/include (found version "2.11.1")
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
      -- Looking for pthread_create in pthreads
      -- Looking for pthread_create in pthreads - not found
      -- Looking for pthread_create in pthread
      -- Looking for pthread_create in pthread - not found
      -- Found Threads: TRUE
      -- Using Win32 for window creation
      CMake Deprecation Warning at external/SDL/SDL/CMakeLists.txt:5 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.


      -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
      -- Looking for __GLIBC__
      -- Looking for __GLIBC__ - not found
      -- Looking for immintrin.h
      -- Looking for immintrin.h - found
      -- Looking for stdint.h
      -- Looking for stdint.h - found
      -- Performing Test HAVE_WIN32_CC
      -- Performing Test HAVE_WIN32_CC - Success
      -- Looking for d3d9.h
      -- Looking for d3d9.h - found
      -- Looking for d3d11_1.h
      -- Looking for d3d11_1.h - found
      -- Performing Test HAVE_D3D12_H
      -- Performing Test HAVE_D3D12_H - Success
      -- Looking for ddraw.h
      -- Looking for ddraw.h - found
      -- Looking for dsound.h
      -- Looking for dsound.h - found
      -- Looking for dinput.h
      -- Looking for dinput.h - found
      -- Looking for dxgi.h
      -- Looking for dxgi.h - found
      -- Performing Test HAVE_XINPUT_H
      -- Performing Test HAVE_XINPUT_H - Success
      -- Performing Test HAVE_XINPUT_GAMEPAD_EX
      -- Performing Test HAVE_XINPUT_GAMEPAD_EX - Failed
      -- Performing Test HAVE_XINPUT_STATE_EX
      -- Performing Test HAVE_XINPUT_STATE_EX - Failed
      -- Performing Test HAVE_WINDOWS_GAMING_INPUT_H
      -- Performing Test HAVE_WINDOWS_GAMING_INPUT_H - Success
      -- Looking for tpcshrd.h
      -- Looking for tpcshrd.h - found
      -- Looking for roapi.h
      -- Looking for roapi.h - found
      -- Looking for mmdeviceapi.h
      -- Looking for mmdeviceapi.h - found
      -- Looking for audioclient.h
      -- Looking for audioclient.h - found
      -- Looking for sensorsapi.h
      -- Looking for sensorsapi.h - found
      -- Looking for shellscalingapi.h
      -- Looking for shellscalingapi.h - found
      -- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.41.0.windows.2")
      CMake Deprecation Warning at external/SDL/SDL/CMakeLists.txt:3143 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.


      --
      -- SDL2 was configured with the following options:
      --
      -- Platform: Windows-10.0.22631
      -- 64-bit:   TRUE
      -- Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx86/x64/cl.exe
      -- Revision: SDL-release-2.26.1-11-gd992d4f23
      --
      -- Subsystems:
      --   Atomic:        ON
      --   Audio: ON
      --   Video: ON
      --   Render:        ON
      --   Events:        ON
      --   Joystick:      ON
      --   Haptic:        ON
      --   Hidapi:        ON
      --   Power: ON
      --   Threads:       ON
      --   Timers:        ON
      --   File:  ON
      --   Loadso:        ON
      --   CPUinfo:       ON
      --   Filesystem:    ON
      --   Sensor:        ON
      --   Locale:        ON
      --   Misc:  ON
      --
      -- Options:
      --   SDL2_DISABLE_INSTALL        (Wanted: ON): OFF
      --   SDL2_DISABLE_SDL2MAIN       (Wanted: OFF): OFF
      --   SDL2_DISABLE_UNINSTALL      (Wanted: OFF): OFF
      --   SDL_3DNOW                   (Wanted: ON): OFF
      --   SDL_ALSA                    (Wanted: OFF): OFF
      --   SDL_ALSA_SHARED             (Wanted: OFF): OFF
      --   SDL_ALTIVEC                 (Wanted: ON): OFF
      --   SDL_ARMNEON                 (Wanted: OFF): OFF
      --   SDL_ARMSIMD                 (Wanted: OFF): OFF
      --   SDL_ARTS                    (Wanted: OFF): OFF
      --   SDL_ARTS_SHARED             (Wanted: OFF): OFF
      --   SDL_ASAN                    (Wanted: OFF): OFF
      --   SDL_ASSEMBLY                (Wanted: ON): OFF
      --   SDL_ASSERTIONS              (Wanted: auto): auto
      --   SDL_BACKGROUNDING_SIGNAL    (Wanted: OFF): OFF
      --   SDL_CCACHE                  (Wanted: ON): OFF
      --   SDL_CLOCK_GETTIME           (Wanted: OFF): OFF
      --   SDL_COCOA                   (Wanted: OFF): OFF
      --   SDL_DBUS                    (Wanted: OFF): OFF
      --   SDL_DIRECTFB                (Wanted: OFF): OFF
      --   SDL_DIRECTFB_SHARED         (Wanted: OFF): OFF
      --   SDL_DIRECTX                 (Wanted: ON): ON
      --   SDL_DISKAUDIO               (Wanted: ON): ON
      --   SDL_DUMMYAUDIO              (Wanted: ON): ON
      --   SDL_DUMMYVIDEO              (Wanted: ON): ON
      --   SDL_ESD                     (Wanted: OFF): OFF
      --   SDL_ESD_SHARED              (Wanted: OFF): OFF
      --   SDL_FOREGROUNDING_SIGNAL    (Wanted: OFF): OFF
      --   SDL_FUSIONSOUND             (Wanted: OFF): OFF
      --   SDL_FUSIONSOUND_SHARED      (Wanted: OFF): OFF
      --   SDL_GCC_ATOMICS             (Wanted: OFF): OFF
      --   SDL_HIDAPI                  (Wanted: ON): ON
      --   SDL_HIDAPI_JOYSTICK         (Wanted: ON): ON
      --   SDL_HIDAPI_LIBUSB           (Wanted: OFF): OFF
      --   SDL_IBUS                    (Wanted: OFF): OFF
      --   SDL_INSTALL_TESTS           (Wanted: OFF): OFF
      --   SDL_JACK                    (Wanted: OFF): OFF
      --   SDL_JACK_SHARED             (Wanted: OFF): OFF
      --   SDL_KMSDRM                  (Wanted: OFF): OFF
      --   SDL_KMSDRM_SHARED           (Wanted: OFF): OFF
      --   SDL_LIBC                    (Wanted: OFF): OFF
      --   SDL_LIBSAMPLERATE           (Wanted: OFF): OFF
      --   SDL_LIBSAMPLERATE_SHARED    (Wanted: OFF): OFF
      --   SDL_METAL                   (Wanted: OFF): OFF
      --   SDL_MMX                     (Wanted: ON): OFF
      --   SDL_NAS                     (Wanted: OFF): OFF
      --   SDL_NAS_SHARED              (Wanted: OFF): OFF
      --   SDL_OFFSCREEN               (Wanted: ON): ON
      --   SDL_OPENGL                  (Wanted: ON): ON
      --   SDL_OPENGLES                (Wanted: ON): ON
      --   SDL_OSS                     (Wanted: OFF): OFF
      --   SDL_PIPEWIRE                (Wanted: OFF): OFF
      --   SDL_PIPEWIRE_SHARED         (Wanted: OFF): OFF
      --   SDL_PTHREADS                (Wanted: OFF): OFF
      --   SDL_PTHREADS_SEM            (Wanted: OFF): OFF
      --   SDL_PULSEAUDIO              (Wanted: OFF): OFF
      --   SDL_PULSEAUDIO_SHARED       (Wanted: OFF): OFF
      --   SDL_RENDER_D3D              (Wanted: ON): ON
      --   SDL_RENDER_METAL            (Wanted: OFF): OFF
      --   SDL_RPATH                   (Wanted: OFF): OFF
      --   SDL_RPI                     (Wanted: OFF): OFF
      --   SDL_SNDIO                   (Wanted: OFF): OFF
      --   SDL_SNDIO_SHARED            (Wanted: OFF): OFF
      --   SDL_SSE                     (Wanted: ON): ON
      --   SDL_SSE2                    (Wanted: ON): ON
      --   SDL_SSE3                    (Wanted: ON): ON
      --   SDL_SSEMATH                 (Wanted: ON): OFF
      --   SDL_STATIC_PIC              (Wanted: OFF): OFF
      --   SDL_SYSTEM_ICONV            (Wanted: ON): OFF
      --   SDL_TESTS                   (Wanted: OFF): OFF
      --   SDL_VENDOR_INFO             (Wanted: ): OFF
      --   SDL_VIRTUAL_JOYSTICK        (Wanted: ON): ON
      --   SDL_VIVANTE                 (Wanted: OFF): OFF
      --   SDL_VULKAN                  (Wanted: ON): ON
      --   SDL_WASAPI                  (Wanted: ON): ON
      --   SDL_WAYLAND                 (Wanted: OFF): OFF
      --   SDL_WAYLAND_LIBDECOR        (Wanted: OFF): OFF
      --   SDL_WAYLAND_LIBDECOR_SHARED (Wanted: OFF): OFF
      --   SDL_WAYLAND_QT_TOUCH        (Wanted: OFF): OFF
      --   SDL_WAYLAND_SHARED          (Wanted: OFF): OFF
      --   SDL_X11                     (Wanted: OFF): OFF
      --   SDL_X11_SHARED              (Wanted: OFF): OFF
      --   SDL_X11_XCURSOR             (Wanted: OFF): OFF
      --   SDL_X11_XDBE                (Wanted: OFF): OFF
      --   SDL_X11_XFIXES              (Wanted: OFF): OFF
      --   SDL_X11_XINPUT              (Wanted: OFF): OFF
      --   SDL_X11_XRANDR              (Wanted: OFF): OFF
      --   SDL_X11_XSCRNSAVER          (Wanted: OFF): OFF
      --   SDL_X11_XSHAPE              (Wanted: OFF): OFF
      --   SDL_XINPUT                  (Wanted: ON): ON
      --
      --  CFLAGS:        /DWIN32 /D_WINDOWS
      --  EXTRA_CFLAGS:
      --  EXTRA_LDFLAGS:
      --  EXTRA_LIBS:    user32;gdi32;winmm;imm32;ole32;oleaut32;version;uuid;advapi32;setupapi;shell32;dinput8
      --
      --  Build Shared Library: ON
      --  Build Static Library: OFF
      --
      -- Performing Test CHECK_CPU_ARCHITECTURE_X86
      -- Performing Test CHECK_CPU_ARCHITECTURE_X86 - Failed
      ccache not found cannot use
      -- Library hello_imgui
      CMake Warning at external/hello_imgui/hello_imgui/src/hello_imgui/CMakeLists.txt:64 (find_package):
        By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
        asked CMake to find a package configuration file provided by "SDL2", but
        CMake did not find one.

        Could not find a package configuration file provided by "SDL2" with any of
        the following names:

          SDL2Config.cmake
          sdl2-config.cmake

        Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
        "SDL2_DIR" to a directory containing one of the above files.  If "SDL2"
        provides a separate development package or SDK, be sure it has been
        installed.
      Call Stack (most recent call first):
        external/hello_imgui/hello_imgui/src/hello_imgui/CMakeLists.txt:86 (link_sdl)


      CMake Warning at external/immvision/immvision/cmake/find_opencv.cmake:216 (find_package):
        By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
        asked CMake to find a package configuration file provided by "OpenCV", but
        CMake did not find one.

        Could not find a package configuration file provided by "OpenCV" with any
        of the following names:

          OpenCVConfig.cmake
          opencv-config.cmake

        Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
        "OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"
        provides a separate development package or SDK, be sure it has been
        installed.
      Call Stack (most recent call first):
        external/immvision/CMakeLists.txt:2 (immvision_find_opencv)


      FIND OPENCV use immvision_download_opencv_official_package_win
      -- Populating opencv_official_package_win
      -- Configuring done (0.2s)
      -- Generating done (0.0s)
      -- Build files have been written to: C:/Users/shen/AppData/Local/Temp/pip-req-build-b8604ehv/_skbuild/win-amd64-3.12/cmake-build/_deps/opencv_official_package_win-subbuild
      ninja: error: Stat(C:/Users/shen/AppData/Local/Temp/pip-req-build-b8604ehv/_skbuild/win-amd64-3.12/cmake-build/_deps/opencv_official_package_win-subbuild/opencv_official_package_win-populate-prefix/src/opencv_official_package_win-populate-stamp/opencv_official_package_win-populate-done): Filename longer than 260 characters
      CMake Error at C:/Users/shen/AppData/Local/Temp/pip-build-env-j79e7p0d/overlay/Lib/site-packages/cmake/data/share/cmake-3.27/Modules/FetchContent.cmake:1662 (message):
        Build step for opencv_official_package_win failed: 1
      Call Stack (most recent call first):
        C:/Users/shen/AppData/Local/Temp/pip-build-env-j79e7p0d/overlay/Lib/site-packages/cmake/data/share/cmake-3.27/Modules/FetchContent.cmake:1802:EVAL:2 (__FetchContent_directPopulate)
        C:/Users/shen/AppData/Local/Temp/pip-build-env-j79e7p0d/overlay/Lib/site-packages/cmake/data/share/cmake-3.27/Modules/FetchContent.cmake:1802 (cmake_language)
        C:/Users/shen/AppData/Local/Temp/pip-build-env-j79e7p0d/overlay/Lib/site-packages/cmake/data/share/cmake-3.27/Modules/FetchContent.cmake:2016 (FetchContent_Populate)
        external/immvision/immvision/cmake/find_opencv.cmake:53 (FetchContent_MakeAvailable)
        external/immvision/immvision/cmake/find_opencv.cmake:222 (immvision_download_opencv_official_package_win)
        external/immvision/CMakeLists.txt:2 (immvision_find_opencv)


      -- Configuring incomplete, errors occurred!
      Traceback (most recent call last):
        File "C:\Users\shen\AppData\Local\Temp\pip-build-env-j79e7p0d\overlay\Lib\site-packages\skbuild\setuptools_wrap.py", line 666, in setup
          env = cmkr.configure(
                ^^^^^^^^^^^^^^^
        File "C:\Users\shen\AppData\Local\Temp\pip-build-env-j79e7p0d\overlay\Lib\site-packages\skbuild\cmaker.py", line 357, in configure
          raise SKBuildError(msg)

      An error occurred while configuring with CMake.
        Command:
          'C:\Users\shen\AppData\Local\Temp\pip-build-env-j79e7p0d\overlay\Lib\site-packages\cmake\data\bin/cmake.exe' 'C:\Users\shen\AppData\Local\Temp\pip-req-build-b8604ehv' -G Ninja -D_SKBUILD_FORCE_MSVC=1930 --no-warn-unused-cli '-DCMAKE_INSTALL_PREFIX:PATH=C:\Users\shen\AppData\Loca\overlay\Lib\site-packages\skbuild\resources\cmake' '-DPYTHON_EXECUTABLE:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\python.exe' '-DPYTHON_INCLUDE_DIR:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\Include' '-DPYTHON_LIBRARY:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\libs\python312.lib' '-DPython_EXECUTABLE:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\python.exe' '-DPython_ROOT_DIR:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312' -DPython_FIND_REGISTRY:STRING=NEVER '-DPython_INCLUDE_DIR:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\Include' '-DPython_LIBRARY:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\libs\python312.lib' '-DPython3_EXECUTABLE:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\python.exe' '-DPython3_ROOT_DIR:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312' -DPython3_FIND_REGISTRY:STRING=NEVER '-DPython3_INCLUDE_DIR:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\Include' '-DPython3_LIBRARY:PATH=C:\Users\shen\AppData\Local\Programs\Python\Python312\libs\python312.lib' -DCMAKE_BUILD_TYPE:STRING=Release
        Source directory:
          C:\Users\shen\AppData\Local\Temp\pip-req-build-b8604ehv
        Working directory:
          C:\Users\shen\AppData\Local\Temp\pip-req-build-b8604ehv\_skbuild\win-amd64-3.12\cmake-build
      Please see CMake's output for more information.

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for imgui-bundle
Failed to build imgui-bundle
ERROR: Could not build wheels for imgui-bundle, which is required to install pyproject.toml-based projects

Regarding PyGLM, i already created an issue in their repo.

demo request: storing multiple docker/viewport layouts in imgui.ini

The issue of how to store and retrieve multiple layouts has been discussed a bit, but I think a good example would be extremely valuable, and would promote use of docker/viewports much more broadly, and extend your docking example. This currently has "restore default layout" - which is obviously already a good start on this.

This would mean not only would the positions of all the windows be saved, but their current state (visible or not) on close or at a specific saved/restore point.

This has been discussed a few times, but otherwise not comprehensively managed
ocornut/imgui#4033
ocornut/imgui#2564
pthom/hello_imgui#52

imgui.internal.splitter_behavior incorrect

\imgui_bundle\imgui\internal.pyi line 6023. The C++ signature is:

IMGUI_API bool          SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f, ImU32 bg_col = 0);

But the python signature

def splitter_behavior(
    bb: ImRect,
    id_: ID,
    axis: Axis,
    size1: np.ndarray,
    size2: np.ndarray,
    min_size2: float,
    hover_extend: float = 0.0,
    hover_visibility_delay: float = 0.0,
    bg_col: ImU32 = 0,
) -> bool

is missing min_size1.

Also, the call to `` is wrong:

ImGui::SplitterBehavior(bb, id, axis, static_cast<float *>(size1_from_pyarray), static_cast<float *>(size2_from_pyarray), static_cast<float>(size2_count), min_size2, hover_extend, hover_visibility_delay, bg_col);

there shouldn't be static_cast<float>(size2_count)

The more appropriate signature here may be:

def splitter_behavior(
    bb: ImRect,
    id_: ID,
    axis: Axis,
    size1: float,
    size2: float,
    min_size1: float,
    min_size2: float,
    hover_extend: float = 0.0,
    hover_visibility_delay: float = 0.0,
    bg_col: ImU32 = 0,
) -> bool, float, float

using _adapt_modifiable_immutable_to_return to return the modified values of size1 and size2

ImGuiTableSortSpecs isn't wrapped correctly

I think ImGuiTableSortSpecs isn't wrapped correctly. specs should be a list of TableColumnSortSpecs, not a single one. My pyimgui code has for sort_spec in sort_specs_in.specs, where sort_specs_in is a ImGuiTableSortSpecs gotten from imgui.table_get_sort_specs().

macos deployment target

Despite your pyproject.toml listing 11.0 as a deployment target, the arm64 (but not the x86_64) wheels for 3.10 and 3.9 seem to have 13.0 as deployment target, see here: https://pypi.org/project/imgui-bundle/#files. That is causing trouble for some of my users who are on an M1, its a pretty high requirement to reach. Is it possible to correct that?

make ImVec2 and ImVec4 transparent / constructible from list, tuple, and perhaps numpy.array

What would make the library a bit nicer to use would be some implicit conversions. For instance, i had imgui.get_style().item_spacing = (5,5) which worked fine with pyimgui, but now i need to assign a imgui.ImVec2(5,5) instead. It would be nice if such vectors would be transparently handled so users don't have to sprinkle ImVec2s all over the code. I guess i'll run into a similar thing soon with colors. Right now my pyimgui code is imgui.get_style().colors[imgui.Col_.modal_window_dim_bg] = (0, 0, 0, 0.5), which i suppose I'll need to change to imgui.get_style().colors[imgui.Col_.modal_window_dim_bg] = imgui.ImVec4(0, 0, 0, 0.5).

It would be nice if such setters and other functions that take an ImVec2 or ImVec4 would also take tuples, lists and perhaps even numpy.arrays.

Somewhat relatedly, it would be great if you could make imgui.ImVec2 and imgui.ImVec4 iterable so that statements such as *imgui.ImVec4(0.,0.,0.,0.), for x in imgui.ImVec2(0.,0.) and list comprehensions would be legal and possible.

Font loading doesn't work for me

And in my port i don't get font loading to work. That is, my icons show up as question marks. I have tried adding

imgui_backends.opengl3_destroy_fonts_texture()
imgui_backends.opengl3_create_fonts_texture()

after the calls to imgui.font_atlas_add_font_from_file_ttf which i think should be needed because else the new font texture doesn't get built (not needed in your demo though, as you call these before the very first frame is rendered, and fonts are set up in ImGui_ImplOpenGL3_CreateDeviceObjects() which is called the first frame). So adding those calls didn't help. Guess i am doing something wrong as your demo does work. But what i have now worked with pyimgui, so i am wondering what the difference/my oversight is...

Also, when i try to use the ImFont returned from imgui.font_atlas_add_font_from_file_ttf with imgui.push_font, it asserts, probably because the font isn't loaded? I may be missing something here. Code is around here: https://github.com/dcnieho/glassesValidator/blob/imgui_bundle/src/glassesValidator/GUI/_impl/gui.py#L982

Could you also bind ImGui's OpenGL2 backend?

Hi, Pascal,

I just met this awesome repo and trying to use it in my projects.
There were some shaders only support OpenGL 2.1/GLSL 120.
So I have to use GL2 in my project.
I saw imgui_bundle only binded GL3 backend as below.

m.def("opengl3_init",
ImGui_ImplOpenGL3_Init, py::arg("glsl_version"));
m.def("opengl3_shutdown",
ImGui_ImplOpenGL3_Shutdown);
m.def("opengl3_new_frame",
ImGui_ImplOpenGL3_NewFrame);
m.def("opengl3_render_draw_data",
ImGui_ImplOpenGL3_RenderDrawData, py::arg("draw_data"));
m.def("opengl3_create_fonts_texture",
ImGui_ImplOpenGL3_CreateFontsTexture);
m.def("opengl3_destroy_fonts_texture",
ImGui_ImplOpenGL3_DestroyFontsTexture);
m.def("opengl3_create_device_objects",
ImGui_ImplOpenGL3_CreateDeviceObjects);
m.def("opengl3_destroy_device_objects",
ImGui_ImplOpenGL3_DestroyDeviceObjects);
//////////////////// </generated_from:imgui_impl_opengl3.h> ////////////////////

Could you also add the Dear ImGui's OpenGL2 backend support?

IMGUI_IMPL_API bool     ImGui_ImplOpenGL2_Init();
IMGUI_IMPL_API void     ImGui_ImplOpenGL2_Shutdown();
IMGUI_IMPL_API void     ImGui_ImplOpenGL2_NewFrame();
IMGUI_IMPL_API void     ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data);


// Called by Init/NewFrame/Shutdown
IMGUI_IMPL_API bool     ImGui_ImplOpenGL2_CreateFontsTexture();
IMGUI_IMPL_API void     ImGui_ImplOpenGL2_DestroyFontsTexture();
IMGUI_IMPL_API bool     ImGui_ImplOpenGL2_CreateDeviceObjects();
IMGUI_IMPL_API void     ImGui_ImplOpenGL2_DestroyDeviceObjects();

fonts really required ?

hye, thanks for the work !!
is there a way to remove so much fonts required on a basic integration ?
thanks

use sdl and the effect of dpi is very strange

  1. I set HELLOIMGUI_USE_SDL_OPENGL3 and IMGUI_BUNDLE_WITH_SDL ON
  2. runnerParams.backendType = HelloImGui::BackendType::Sdl;
  3. my easy code
#include "include.h"

using namespace std;

void Gui()
{
    ImGui::Text("Test text");
}

int main()
{
    HelloImGui::SimpleRunnerParams runnnerParams;
    runnnerParams.guiFunction = Gui;
    runnnerParams.windowSize = { 400, 300 };

    HelloImGui::RunnerParams runnerParams = runnnerParams.ToRunnerParams();
    runnerParams.imGuiWindowParams.configWindowsMoveFromTitleBarOnly = true;
    runnerParams.backendType = HelloImGui::BackendType::Sdl;

    ImmApp::AddOnsParams addOnsParams;
    //addOnsParams.withMarkdown = true;
    //addOnsParams.withImplot = true;
    ImmApp::Run(runnerParams, addOnsParams);
    return 0;
}
  1. Scaling to 100% is normal
    image

  2. Scaling to 125% is abnormal. I test img button in this situation, the mouse cannot normally click on the displayed button, there seems to be a little deviation. But I can't take a good screenshot of this situation because my screenshot software can't see the mouse pointer
    image
    image

6.When I switch backendType to Glfw, any scaling is normal.So I don't know if I made a mistake in using sdl. I sincerely hope I can get your help, and I'm sorry for my English level

demo_tex_inspect problems

  1. Running it gives me a window that is vertically so big it doesn't fit on my screen.
  2. when running i do get an error:
ERROR: 1:23: 'function' : is removed in Forward Compatible context texture2D
ERROR: 1:23: 'texture2D' : no matching overloaded function found (using implicit conversion)
ERROR: 1:23: 'texture2D' : function is not known
ERROR: 1:23: '+' : wrong operand types no operation '+' exists that takes a left-hand operand of type '4X4 matrix of highp float' and a right operand of type 'uniform 4-component vector of highp float' (or there is no acceptable conversion)
ERROR: 1:23: '=' :  cannot convert from '4X4 matrix of highp float' to '4-component vector of highp float'


ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link shader program! (with GLSL '#version 130
')
Attached fragment shader is not compiled.```

It does seem to work, so perhaps not an issue otherwise. Keep it and report to library author?

two versions of imgui.selectable

Ok, last comment for now. Nice work man on the wrapper, i got my first windows to show even though not everything works yet. Anyway, what i run in now is that there are two versions of imgui.selectable (and i guess there are more like this one) where one takes a bool and returns a bool, and the other takes a pointer to bool and returns a tuple of two bools. Here i made it error so you can see the signatures:

TypeError: selectable(): incompatible function arguments. The following argument types are supported:
    1. (label: str, selected: bool = False, flags: int = 0, size: imgui_bundle._imgui_bundle.imgui.ImVec2 = <imgui_bundle._imgui_bundle.imgui.ImVec2 object at 0x00000285EAB525F0>) -> bool
    2. (label: str, p_selected: bool, flags: int = 0, size: imgui_bundle._imgui_bundle.imgui.ImVec2 = <imgui_bundle._imgui_bundle.imgui.ImVec2 object at 0x00000285EA6D2770>) -> Tuple[bool, bool]

I want to use the latter, but get the former. Even though both are defined in the generated pybind code. I guess that is because their python function syntax is identical? Both just take a bool. Perhaps this is user error. How do i call the latter one with signature returning -> Tuple[bool, bool]?

We had a closely related discussion about this before, IIRC. The two functions are redundant for the python binding, so we have to choose one style. for pyimgui compatibility (and because i know of no other good reason) and additional flexibility (this form is more informative) i vote to only expose version 2. I'm not sure if this case can be automatically detected (that two different c++ function lead to a python function with the same arguments) and the choice automated.

Python usage with SDL

Hi!

I am currently using pyimgui with pySDL and moderngl. pyimgui is doing what I want but is a little bit limited. I would like to switch to imgui_bundle for its completness.

Is there an other way to initialize imgui than through immap? All example initialise the window through it.

Update: I saw an example on GLFW, IMGUI and OpenGL. Is there a backend for SDL2?

Thx for your time. :)

ImFontAtlas::GetTexDataAsRGBA32()

I asked about getting access to ImFontAtlas::GetTexDataAsRGBA32(). You implemented font_atlas_get_tex_data_as_rgba32, but i notice that it is only present (commented out) in the .pyi file. Have you nixed it and i missed the testing window?

default value fail for functions taking ImColor

I found something that turns out to be a big problem: Functions taking an ImColor argument but specifying a ImU32 default value.
An example is this from imspinner:

def spinner_ang_triple(
    label: str,
    radius1: float,
    radius2: float,
    radius3: float,
    thickness: float,
    c1: ImColor = 0xffffffff,
    c2: ImColor = 0xffffff80,
    c3: ImColor = 0xffffffff,
    speed: float = 2.8,
    angle: float = IM_PI
    ) -> None:
    pass

0xffffffff is not an ImColor, and thus you get an incompatible function arguments error when not specifying that input argument yourself (or when specifying it using, for example, imgui.color_convert_float4_to_u32() as i did). On the C++ side this is not a problem as there is an ImColor constructor taking ImU32 and this is also wrapped by imgui_bundle. However, Python/PyBind would not do this conversion for you automatically and instead you get that incompatible function arguments error.

So, I thought, ah, ImColor also needs a bunch of special helper functions like ImVec2 and ImVec4. It does, I didn't have ImColor on my radar when i made the other ones. Among those would be a line py::implicitly_convertible<ImU32, ImColor>(); telling pybind that there is a conversion here, solving the issues we're seeing. However, when i add that, I get an error when importing the module: ImportError: implicitly_convertible: Unable to find type unsigned int. Googling that, i find this, and more importantly this associated PR. So, PyBind doesn't support implicit conversion for native types, only for user-defined types. As you see, that PR was not accepted in the end. That means there is a problem here that can only be solved by fixing the signatures of all functions that expect an ImColor and specify a default color as an int. I.e., this in the cpp does work:

m.def("spinner_ang_triple",
        ImSpinner::SpinnerAngTriple, py::arg("label"), py::arg("radius1"), py::arg("radius2"), py::arg("radius3"), py::arg("thickness"), py::arg("c1") = ImColor(0xffffffff), py::arg("c2") = ImColor(0xffffff80), py::arg("c3") = ImColor(0xffffffff), py::arg("speed") = 2.8f, py::arg("angle") = IM_PI);

Note that i added ImColor() around the default arguments. The corresponding stub would be:

def spinner_ang_triple(
    label: str,
    radius1: float,
    radius2: float,
    radius3: float,
    thickness: float,
    c1: ImColor = ImColor(0xffffffff),
    c2: ImColor = ImColor(0xffffff80),
    c3: ImColor = ImColor(0xffffffff),
    speed: float = 2.8,
    angle: float = IM_PI
    ) -> None:
    pass

This is a hairy one to fix... Best would almost be to re-examine adding support for this to pybind. Even if the default arguments are fixed with something like the above (hopefully some kind of opt in mechanism of the generator) that still leaves the problem that users unexpectedly cannot use ImU32's for colors, something you might do when porting from C++ or from pyimgui where this did work.

assert error when creating tab bar

Thanks for your work. I'm testing imgui functions and met the following error when creating tab bar and tab items.

from imgui_bundle import imgui, immapp, hello_imgui

def show_gui():
    if imgui.is_key_pressed(imgui.Key.escape):
        runner_params.app_shall_exit = True

    if imgui.begin_tab_bar('###tabs', imgui.TabBarFlags_.none):
        if imgui.begin_tab_item('sizes'):
            imgui.text('sizes')
            imgui.end_tab_item()
        if imgui.begin_tab_item('colors'):
            imgui.text('colors')
            imgui.end_tab_item()
        imgui.end_tab_bar()
    
if __name__ == "__main__":
    runner_params = hello_imgui.RunnerParams()
    runner_params.callbacks.show_gui = show_gui
    immapp.run(runner_params=runner_params)

assert error:

Traceback (most recent call last):
  File "gui.py", line 26, in <module>
    immapp.run(runner_params=runner_params)
  File "gui.py", line 21, in show_gui
    imgui.end_tab_bar()
RuntimeError: IM_ASSERT( window->IDStack.Size > 1 )   ---   imgui.cpp:8170

It's ok with only one single tab item.
Where did the problem occur?

CI Wheel: is github throttling me down?

See failed builds after 1hour:

https://github.com/pthom/imgui_bundle/actions/runs/3663854181/jobs/6193892877#step:3:7659 (windows)

           file='D:/a/imgui_bundle/imgui_bundle/_skbuild/win-amd64-3.10/cmake-build/_deps/opencv_static_package_win-subbuild/opencv_static_package_win-populate-prefix/src/opencv-4.6.0_official_win_x64_world.zip'
    -- MD5 hash of
        D:/a/imgui_bundle/imgui_bundle/_skbuild/win-amd64-3.10/cmake-build/_deps/opencv_static_package_win-subbuild/opencv_static_package_win-populate-prefix/src/opencv-4.6.0_official_win_x64_world.zip
      does not match expected value
        expected: 'a9d92bdf8510d09c3bf3cb080731ea91'
          actual: 'c3a1056d10c9425209b22549263d995c'

And https://github.com/pthom/imgui_bundle/actions/runs/3663854181/jobs/6193892769#step:3:12774
(linux Building cp38-manylinux_i686 wheel)

This particular feel failed although the previous wheels cp38-manylinux_x86_64, cp39-manylinux_x86_64, cp310-manylinux_x86_64, cp311-manylinux_x86_64 wheel succeeded.
I had similar occurrences in previous builds.

   ============================= test session starts ==============================
  platform linux -- Python 3.8.15, pytest-7.2.0, pluggy-1.0.0
  rootdir: /project, configfile: pytest.ini
  collected 1 item
  
  Fatal Python error: Segmentation fault
  
  Current thread 0xf7ca8940 (most recent call first):
    File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
    File "<frozen importlib._bootstrap_external>", line 1166 in create_module
    File "<frozen importlib._bootstrap>", line 556 in module_from_spec
    File "<frozen importlib._bootstrap>", line 657 in _load_unlocked

porting my app to imgui_bundle.imgui

This is using pip-installed v0.6.5

I decided to port a project from pyimgui to imgui_bundle as I would like to post it to pypi and I can’t do that with direct dependencies (like pyimgui version 2.0).

So, some observations from porting this program (not yet available online).

First it tried to simple replace
import imgui with from pyimgui to imgui_bundle.imgui. Obviously a bunch of code adjustments are needed, mostly for the different flags (e.g. imgui.TABLE_SCROLL_X -> imgui.ImGuiTableFlags_.scroll_x). These all get a bit long, even if they are very tight to the original imgui header. That said, this naming is not ideal I think and we have some freedom here since in C++ you’d simply directly use ImGuiTableFlags_ScrollX. imgui.TableFlags.scroll_x would be nice, or imgui.table_flags.scroll_x to be more pythonic and have consistent change from camel to snake case. So that’s no double imgui, and no trailing underscore.

Relatedly, autocomplete works very nicely, but is a little confusing as you have each enum twice (e.g. imgui.ImGuiTableFlags and imgui.ImGuiTableFlags_. The former is just an int if I understand correctly. Shall we just have the latter (ideally renamed like above)?
My biggest problem: how do I use imgui by itself? Or is that not the idea? I have no equivalent of from imgui.integrations.glfw import GlfwRenderer in imgui_bundle. Is the idea that you must use the hello_imgui wrapper? That makes it much less of a drop-in replacement. And I think I cannot use that, because I use glfw callbacks for my app, but can’t access those, I think? I have set up:

glfw.set_char_callback(self.window, self.char_callback)
glfw.set_window_focus_callback(self.window, self.focus_callback)
glfw.set_window_pos_callback(self.window, self.pos_callback)
glfw.set_drop_callback(self.window, self.drop_callback)
glfw.swap_interval(globals.settings.vsync_ratio)

And other interaction with glfw (such as window scaling when moving between dpi monitors).
Can I set these up? How?

Does imgui_bundle also expose its opengl binding? Can I port import OpenGL.GL as gl to something in the imgui_bundle, or is that out of scope? I’m asking as my code for instance does:

max_tex_size = gl.glGetIntegerv(gl.GL_MAX_TEXTURE_SIZE)
imgui.io.fonts.texture_desired_width = max_tex_size

Some small observations:

  1. The flag imgui_internal.ImGuiSelectableFlagsPrivate_.im_gui_selectable_flags_select_on_click is a bit over the top, some conversion error?
  2. FLT_MIN (pyimgui: imgui.FLOAT_MIN) is unavailable. Is ok, can be replaced with np.finfo('single').tiny (untested), but seems a bit heavy to require numpy for just that. That pyimgui provides imgui.FLOAT_MIN is a good solution I think. Users may well get this wrong otherwise, since a python float is a double.
  3. This should work, but doesn’t:
    from imgui_bundle import imgui as imgui
    imgui.create_context()
    imgui.get_io().ini_filename = str(utils.get_data_path() / "imgui.ini")
    # raises: AttributeError: can't set attribute
    
  4. Are you planning to also bundle your immvision library? I’m not exactly sure on what it does, but the description is interesting!

draw_list.add_image_rounded signature issue?

This might be user error. I have an image i want to draw. It is uploaded through direct interaction with OpenGL and i have a texture id. I then call draw_list.add_image_rounded(texture_id, pos, pos2, *args, flags=flags, **kwargs) and get the following error

TypeError: add_image_rounded(): incompatible function arguments. The following argument types are supported:
    1. (self: imgui_bundle._imgui_bundle.imgui.ImDrawList, user_texture_id: capsule, p_min: imgui_bundle._imgui_bundle.imgui.ImVec2, p_max: imgui_bundle._imgui_bundle.imgui.ImVec2, uv_min: imgui_bundle._imgui_bundle.imgui.ImVec2, uv_max: imgui_bundle._imgui_bundle.imgui.ImVec2, col: int, rounding: float, flags: int = 0) -> None

Invoked with: <imgui_bundle._imgui_bundle.imgui.ImDrawList object at 0x000001973685C630>, 2, <imgui_bundle._imgui_bundle.imgui.ImVec2 object at 0x000001973685C0F0>, <imgui_bundle._imgui_bundle.imgui.ImVec2 object at 0x000001973685C1B0>; kwargs: flags=<ImDrawFlags_.round_corners_all: 240>, rounding=6.0

Removing *args from the call (its an empty tuple) and explicitly naming the other two arguments as p_min and p_max doesn't change this, same incompatible arguments error.

type(self.texture_id) returns <class 'numpy.uintc'>, as is (apparently) returned by gl.glGenTextures(1) (import OpenGL.GL as gl)
I note that 'add_image_rounded()' expects a capsule, but i do not know what that is or how to provide it. I would expect providing a normal uint, like with other opengl programming, should work.

Is it possible to dynamically add dockable windows.

I want to dynamically add imgui windows in python. I would expect something like.

# my_dockable_window in MainDockSpace
hello_imgui.get_runner_params().docking_params.dockable_windows.append(my_dockable_window)

Would create a window and show it docked in Maindockspace.

Is this possible. If it is how would I do this and should there be an demo.

PS. First ever github issue or issue in fact.

Please share your feedback

"ImGui Bundle" is a brand new python and C++ package (Oct 2022). It works on MacOS, Windows and Linux.

Feedback from users would be appreciated in order to make sure its installation works on different platforms.

If you installed it, and if you have time, could you please answer the following:

Python users

  • How did you install imgui-bundle for python: via git clone + pip install -v . or via pip install imgui-bundle (i.e install from pypi)
  • If you installed from pypi, which platform are you using ? Did the build use the prebuilt wheel, or did it have to build from source?
  • Does imgui_bundle_demo work ?
  • Do you have code completion for imgui and implot in your IDE (and which IDE are you using)? If not, please read the FAQ

C++ Users

  • Did the code compile painlessly, and do the demo work?

Thanks in advance!

[Question] Non-OpenGL backend support (Metal)

Hi! Sorry if I'm missing something obvious, but do I understand correctly that like hello-imgui on which it is based, imgui-bundle supports only OpenGL as a backend? My use case is an app that uses Metal for rendering, and I'm curious if it's possible to use imgui-bundle for overlay UI, or I should stick with the "raw" ImGui? Thanks!

Conan package source

Hi!
It would be very interesting to add this repo to the conan package center.
Is there any plan to add it?
Best regards!

don't pip install opencv-python if opencv-contrib-python is installed

I just pip-installed the current dev branch into the venv for my app. My app uses functionality from the opencv-contrib-python. After installing imgui_bundle, i now have both opencv-contrib-python and opencv-python installed, and trying to use functionality from the contrib version does not work.

In short, opencv-python should not be installed if opencv-contrib-python is already installed. I am not sure if there is a way to specify that with the dependency infrastructure (e.g. somehow to say that either of these is fine), but right now this messes with a perfectly fine set of pip packages ;)

At exit customization

Hello Imgui offers options related to an application exit:

  • The App menu contains a default Quit option
  • the runner params have an appShallExit setting.
  • there is a BeforeExit callback (when application is already shutting down and you can't change your mind).

I am wondering whether there is a way to combine the existing settings or some others I have overlooked to inject some logic that would display a confirmation dialog to the user (e.g. "Are you really sure you want to close the app and lose your unsaved changes?") ?

Can't set imgui.get_io().ini_filename

Q: This should work, but doesn’t: ... imgui.get_io().ini_filename = ...

Well, an automatic generation for `const char * ImGuiIO::IniFilename" is hopeless, since it provides absolutely no storage.
I had to do a manual patch: 6ef5df6

A: use imgui.set_io_ini_filename() instead

how to pip install -v . on windows? multi error

          Hmm, i see that pthom/litgen actually forwards to pthom/srcmlcpp. So i just updated the requirements-dev.txt file.

That gets me to here:

Building wheels for collected packages: srcmlcpp, srcml_caller
  Building wheel for srcmlcpp (pyproject.toml) ... done
  Created wheel for srcmlcpp: filename=srcmlcpp-0.1.0-py3-none-any.whl size=613575 sha256=548a49c907bf7d799ce5738b5e8e02cc6b7854e609900f1e11e88cc4bc34d8a4
  Stored in directory: C:\Users\huml-dkn\AppData\Local\Temp\pip-ephem-wheel-cache-yu5eydfe\wheels\4c\fb\21\2cbb57b39f4b643cb14b59b7f54a4519e0e3c381cc4d608eed
  Building wheel for srcml_caller (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for srcml_caller (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [111 lines of output]


      --------------------------------------------------------------------------------
      -- Trying "Ninja (Visual Studio 17 2022 x64 v143)" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      Not searching for unused variables given on the command line.
      -- The C compiler identification is MSVC 19.34.31935.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- The CXX compiler identification is MSVC 19.34.31935.0
      CMake Warning (dev) at C:/Users/huml-dkn/AppData/Local/Temp/pip-build-env-veuax1i0/overlay/Lib/site-packages/cmake/data/share/cmake-3.25/Modules/CMakeDetermineCXXCompiler.cmake:162 (if):
        Policy CMP0054 is not set: Only interpret if() arguments as variables or
        keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
        details.  Use the cmake_policy command to set the policy and suppress this
        warning.

        Quoted variables like "MSVC" will no longer be dereferenced when the policy
        is set to NEW.  Since the policy is not set the OLD behavior will be used.
      Call Stack (most recent call first):
        CMakeLists.txt:4 (ENABLE_LANGUAGE)
      This warning is for project developers.  Use -Wno-dev to suppress it.

      CMake Warning (dev) at C:/Users/huml-dkn/AppData/Local/Temp/pip-build-env-veuax1i0/overlay/Lib/site-packages/cmake/data/share/cmake-3.25/Modules/CMakeDetermineCXXCompiler.cmake:183 (elseif):
        Policy CMP0054 is not set: Only interpret if() arguments as variables or
        keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
        details.  Use the cmake_policy command to set the policy and suppress this
        warning.

        Quoted variables like "MSVC" will no longer be dereferenced when the policy
        is set to NEW.  Since the policy is not set the OLD behavior will be used.
      Call Stack (most recent call first):
        CMakeLists.txt:4 (ENABLE_LANGUAGE)
      This warning is for project developers.  Use -Wno-dev to suppress it.

      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Configuring done
      -- Generating done
      -- Build files have been written to: C:/Users/huml-dkn/AppData/Local/Temp/pip-install-mycottj2/srcml-caller_6ce31932bc6f4d048523b8433c1e7bf7/_cmake_test_compile/build
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "Ninja (Visual Studio 17 2022 x64 v143)" generator - success
      --------------------------------------------------------------------------------

      Configuring Project
        Working directory:
          C:\Users\huml-dkn\AppData\Local\Temp\pip-install-mycottj2\srcml-caller_6ce31932bc6f4d048523b8433c1e7bf7\_skbuild\win-amd64-3.10\cmake-build
        Command:
          cmake 'C:\Users\huml-dkn\AppData\Local\Temp\pip-install-mycottj2\srcml-caller_6ce31932bc6f4d048523b8433c1e7bf7' -G Ninja '-DCMAKE_INSTALL_PREFIX:PATH=C:\Users\huml-dkn\AppData\Local\Temp\pip-install-mycottj2\srcml-caller_6ce31932bc6f4d048523b8433c1e7bf7\_skbuild\win-amd64-3.10\cmake-install\bindings\srcml_caller' -DPYTHON_VERSION_STRING:STRING=3.10.7 -DSKBUILD:INTERNAL=TRUE '-DCMAKE_MODULE_PATH:PATH=C:\Users\huml-dkn\AppData\Local\Temp\pip-build-env-veuax1i0\overlay\Lib\site-packages\skbuild\resources\cmake' '-DPYTHON_EXECUTABLE:PATH=C:\Users\huml-dkn\Desktop\imgui_bundle\venv\Scripts\python.exe' '-DPYTHON_INCLUDE_DIR:PATH=C:\Program Files\Python310\Include' '-DPYTHON_LIBRARY:PATH=C:\Program Files\Python310\libs\python310.lib' '-DPython_EXECUTABLE:PATH=C:\Users\huml-dkn\Desktop\imgui_bundle\venv\Scripts\python.exe' '-DPython_ROOT_DIR:PATH=C:\Users\huml-dkn\Desktop\imgui_bundle\venv' '-DPython_INCLUDE_DIR:PATH=C:\Program Files\Python310\Include' -DPython_FIND_REGISTRY:STRING=NEVER '-DPython3_EXECUTABLE:PATH=C:\Users\huml-dkn\Desktop\imgui_bundle\venv\Scripts\python.exe' '-DPython3_ROOT_DIR:PATH=C:\Users\huml-dkn\Desktop\imgui_bundle\venv' '-DPython3_INCLUDE_DIR:PATH=C:\Program Files\Python310\Include' -DPython3_FIND_REGISTRY:STRING=NEVER -DCMAKE_BUILD_TYPE:STRING=Release

      -- The C compiler identification is MSVC 19.34.31935.0
      -- The CXX compiler identification is MSVC 19.34.31935.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      'C:/Users/huml-dkn/Desktop/imgui_bundle/venv/Scripts/python.exe' '-c' 'import pybind11; print(pybind11.get_cmake_dir())'
      -- Found PythonInterp: C:/Users/huml-dkn/Desktop/imgui_bundle/venv/Scripts/python.exe (found suitable version "3.10.7", minimum required is "3.6")
      -- Found PythonLibs: C:/Program Files/Python310/libs/python310.lib
      -- Performing Test HAS_MSVC_GL_LTCG
      -- Performing Test HAS_MSVC_GL_LTCG - Success
      -- Found pybind11: C:/Users/huml-dkn/AppData/Local/Temp/pip-build-env-veuax1i0/overlay/Lib/site-packages/pybind11/include (found version "2.10.1")
      -- Project version: 1.0.0
      CMake Error at C:/Users/huml-dkn/AppData/Local/Temp/pip-build-env-veuax1i0/overlay/Lib/site-packages/cmake/data/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
        Could NOT find LibArchive (missing: LibArchive_LIBRARY
        LibArchive_INCLUDE_DIR) (Required is at least version "3")
      Call Stack (most recent call first):
        C:/Users/huml-dkn/AppData/Local/Temp/pip-build-env-veuax1i0/overlay/Lib/site-packages/cmake/data/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
        C:/Users/huml-dkn/AppData/Local/Temp/pip-build-env-veuax1i0/overlay/Lib/site-packages/cmake/data/share/cmake-3.25/Modules/FindLibArchive.cmake:67 (find_package_handle_standard_args)
        external/srcML/src/client/CMakeLists.txt:9 (find_package)


      -- Configuring incomplete, errors occurred!
      See also "C:/Users/huml-dkn/AppData/Local/Temp/pip-install-mycottj2/srcml-caller_6ce31932bc6f4d048523b8433c1e7bf7/_skbuild/win-amd64-3.10/cmake-build/CMakeFiles/CMakeOutput.log".
      Traceback (most recent call last):
        File "C:\Users\huml-dkn\AppData\Local\Temp\pip-build-env-veuax1i0\overlay\Lib\site-packages\skbuild\setuptools_wrap.py", line 632, in setup
          env = cmkr.configure(
        File "C:\Users\huml-dkn\AppData\Local\Temp\pip-build-env-veuax1i0\overlay\Lib\site-packages\skbuild\cmaker.py", line 334, in configure
          raise SKBuildError(

      An error occurred while configuring with CMake.
        Command:
          cmake 'C:\Users\huml-dkn\AppData\Local\Temp\pip-install-mycottj2\srcml-caller_6ce31932bc6f4d048523b8433c1e7bf7' -G Ninja '-DCMAKE_INSTALL_PREFIX:PATH=C:\Users\huml-dkn\AppData\Local\Temp\pip-install-mycottj2\srcml-caller_6ce31932bc6f4d048523b8433c1e7bf7\_skbuild\win-amd64-3.10\cmake-install\bindings\srcml_caller' -DPYTHON_VERSION_STRING:STRING=3.10.7 -DSKBUILD:INTERNAL=TRUE '-DCMAKE_MODULE_PATH:PATH=C:\Users\huml-dkn\AppData\Local\Temp\pip-build-env-veuax1i0\overlay\Lib\site-packages\skbuild\resources\cmake' '-DPYTHON_EXECUTABLE:PATH=C:\Users\huml-dkn\Desktop\imgui_bundle\venv\Scripts\python.exe' '-DPYTHON_INCLUDE_DIR:PATH=C:\Program Files\Python310\Include' '-DPYTHON_LIBRARY:PATH=C:\Program Files\Python310\libs\python310.lib' '-DPython_EXECUTABLE:PATH=C:\Users\huml-dkn\Desktop\imgui_bundle\venv\Scripts\python.exe' '-DPython_ROOT_DIR:PATH=C:\Users\huml-dkn\Desktop\imgui_bundle\venv' '-DPython_INCLUDE_DIR:PATH=C:\Program Files\Python310\Include' -DPython_FIND_REGISTRY:STRING=NEVER '-DPython3_EXECUTABLE:PATH=C:\Users\huml-dkn\Desktop\imgui_bundle\venv\Scripts\python.exe' '-DPython3_ROOT_DIR:PATH=C:\Users\huml-dkn\Desktop\imgui_bundle\venv' '-DPython3_INCLUDE_DIR:PATH=C:\Program Files\Python310\Include' -DPython3_FIND_REGISTRY:STRING=NEVER -DCMAKE_BUILD_TYPE:STRING=Release
        Source directory:
          C:\Users\huml-dkn\AppData\Local\Temp\pip-install-mycottj2\srcml-caller_6ce31932bc6f4d048523b8433c1e7bf7
        Working directory:
          C:\Users\huml-dkn\AppData\Local\Temp\pip-install-mycottj2\srcml-caller_6ce31932bc6f4d048523b8433c1e7bf7\_skbuild\win-amd64-3.10\cmake-build
      Please see CMake's output for more information.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for srcml_caller
Successfully built srcmlcpp
Failed to build srcml_caller
ERROR: Could not build wheels for srcml_caller, which is required to install pyproject.toml-based projects

I see libarchive can be downloaded here, but where do i place it for CMake to find it?

Originally posted by @dcnieho in #51 (comment)

imgui.internal.dock_builder_split_node not wrapped correctly?

It appears ImGui::DockBuilderSplitNode() is not wrapped correctly. Its last two parameters are output pointers, yet the python wrapper has them as normal IDs. I think the Python signature should instead be:

# IMGUI_API ImGuiID       DockBuilderSplitNode(ImGuiID node_id, ImGuiDir split_dir, float size_ratio_for_node_at_dir, ImGuiID* out_id_at_dir, ImGuiID* out_id_at_opposite_dir);     /* original C++ signature */
def dock_builder_split_node(
    node_id: ID,
    split_dir: Dir,
    size_ratio_for_node_at_dir: float,
) -> Tuple[ID,ID,ID]:
    """Create 2 child nodes in this parent node."""
    pass

imgui: cleanup binding SelectableFlagsPrivate_

@dcnieho:

More generally, I see that in litgen setup for imgui, you added
the RegexReplacementList. Do you think that can also be used to clean up
that dirty enum hack of imgui for some of the extensions in internal (like
what is now
imgui.internal.SelectableFlagsPrivate_.im_gui_selectable_flags_select_on_click
and
should more ideally be
imgui.internal.SelectableFlagsPrivate_.select_on_click)?

Usability issue around MenuItem binding

@dcnieho : this is a question for you

When we last discussed about Selectable and MenuItem, we decided to disable some overload because they had the same signature on the python side.

See #36

For MenuItem, we only selected the second overload of those two:

#ifdef IMGUI_BUNDLE_PYTHON_UNSUPPORTED_API
    IMGUI_API bool          MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true);  // return true when activated.
#endif
    IMGUI_API bool          MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true);              // return true when activated + toggle (*p_selected) if p_selected != NULL

However, my opinion is that the second overload is not that friendly in Python. For example, in C++ I can write

if (ImGui::MenuItem("A Custom app menu item"))
      HelloImGui::Log(HelloImGui::LogLevel::Info, "Clicked on A Custom app menu item");

However in python, I must write:

  clicked, _ = imgui.menu_item("A Custom app menu item", "", False)
  if clicked:
      hello_imgui.log(hello_imgui.LogLevel.info, "Clicked on A Custom app menu item")

The second overload has the advantage (and default) of returning a tuple with the selected bool value. However it is not that difficult to switch from the user side.

What do you think?

Pyglet support

Hi,
Do you have any advice as to how I can implement pyglet support for imgui_bundle?

imgui_bundle_demo observations

I have now run imgui_bundle_demo after a successful pip install. observations:

  1. on the imgui bundle screen the list of libraries under about/batteries included needs to be updated
  2. the text editor with code under immediate mode gui is too small on my hidpi screen. Same for the ones under basic code advices (which should be advice by the way), and the other nodes under that
  3. should the log buttons under advanced create items in some log? I don't see any log listing anywhere there. Oh wait, now i get it, those are not buttons to create some fake items, but for filtering the log. running the glfw callback demo creates some entries. Works fine, just didn't understand it.
  4. in demo apps, clicking imgui_example_glfw_opengl3 works, but opens a window that is not DPI scaled, everything is tiny. Not sure if you want to fix that. It also opens a popup with app code that i can't close again, only collapse
  5. demo_custom_fonts works nicely and is correctly scaled
  6. Docking demo button: demo works nicely, only one small thing is that the progress bar when launching the rocket seems to not be dpi scaled, this is what i get:
    image
    also, not all GUI elements work in some of the color schemes (try light) but that might not be something you can do anythign about.
  7. implot tab: all works well, but like the haiku, all the plots are not tall enough. Screenshot:
    image
  8. Markdown spacing isn't great (hidpi problem?), see e.g.:
    image
    and also the spacing after the full stop between sentences in the implot screenshot above (seems not enough space after full stop)
  9. editor demo: link not parsed correctly?
    image
    also, clicking ´test glfw link´ takes the window almost offscreen (top left), can hardly access the Windows window bar to drag it back. maybe set window pos 100,100 instead of 10,10?
  10. additional widgets: all works, but imfiledialog widgets open way too small, guess another hidpi thing. Spinners are possibly a bit small:
    image
  11. something while running the imgui_bundle_demo also put ImGuiMd::OnOpenLink_Default url "images/world.jpg" should start with http! on the command line. Perhaps you know what triggered that.

Can't pip-install requirements-dev.txt

I wanted to just see what the generator does (and then possibly work on #38 (reply in thread)), but pip install -U -r requirements-dev.txt already fails. I know you're not expecting others to use this yet, but thought i may as well mention it here (though i guess technically what i paste below should be an issue in the litgen repo). This is what i got trying to pip-install:

(venv) C:\...\imgui_bundle>pip install -U -r requirements-dev.txt
Collecting litgen@ git+https://github.com/pthom/litgen
  Cloning https://github.com/pthom/litgen to c:\users\huml-dkn\appdata\local\temp\pip-install-sh6uf_z1\litgen_fdb59bc6d2154d2a9479d3c3384255e4
  Running command git clone --filter=blob:none --quiet https://github.com/pthom/litgen 'C:\Users\huml-dkn\AppData\Local\Temp\pip-install-sh6uf_z1\litgen_fdb59bc6d2154d2a9479d3c3384255e4'
  Resolved https://github.com/pthom/litgen to commit 432fb6b424bddf2c5dc838b58cb522226fb45dc0
  Running command git submodule update --init --recursive -q
  error: unable to create file hello_imgui_cmake/android/apkCMake/templates/sdl/gradle_template/app/src/main/java/org/libsdl/app/HIDDeviceBLESteamController.java: Filename too long
  error: unable to create file hello_imgui_cmake/android/apkCMake/templates/sdl/gradle_template/app/src/main/java/org/libsdl/app/HIDDeviceManager.java: Filename too long
  error: unable to create file hello_imgui_cmake/android/apkCMake/templates/sdl/gradle_template/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java: Filename too long
  error: unable to create file hello_imgui_cmake/android/apkCMake/templates/sdl/gradle_template/app/src/main/java/org/libsdl/app/SDLAudioManager.java: Filename too long
  error: unable to create file hello_imgui_cmake/android/apkCMake/templates/sdl/gradle_template/app/src/main/java/org/libsdl/app/SDLControllerManager.java: Filename too long
  From https://github.com/pthom/imgui
   * branch              a08931272922462f8bd4afb52011f8b5bc6a6ebe -> FETCH_HEAD
  Unable to checkout 'c59ba4cf2659648c584dd354ab646811b4cc9aa7' in submodule path 'demos/litgen/imgui_bundle/external/hello_imgui'
  Failed to recurse into submodule path 'demos/litgen/imgui_bundle'
  error: subprocess-exited-with-error

  × git submodule update --init --recursive -q did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

imgui.save_ini_settings_to_memory() default argument problem

ini = imgui.save_ini_settings_to_memory() fails even though the one input argument is optional:

TypeError: save_ini_settings_to_memory(): incompatible function arguments. The following argument types are supported:
    1. (out_ini_size: int = None) -> str

Invoked with:

calling it with e.g. 1000 as argument works fine.

map imgui_internal.h, integrations

Hi! I just came across this project and really like where it is heading. I'm currently using pyimgui and its not fully feature complete (complete enough that its only a minor inconvenience) and more importantly many releases behind. Since its all manual effort, this trouble likely remains.

Your effort here looks like a really good idea. Direct port (so no own flavor) of the great imgui, yet in a way that you can somewhat easily stay up to date with releases and various branches (docking!). Nice. And keeping all the docs intact, very nice.

I had some thoughts, perhaps some are just wrong because i'm not an expert on all of this.

Maybe i have missed it when looking around, but could you map imgui_internal.h as well (perhaps i missed it when having a look)? This is important for users of imgui who want to customize a little further, from something as simple as setting an item as disabled, imgui.internal.push_item_flag(imgui.internal.ITEM_DISABLED, True), to building your whole own widgets. I like the idea of exposing that through a submodule like pyimgui does (see above example).

Second, since i already have a working program using pyimgui (not yet on github), i'm at this stage firstly interested in getting the imgui bit of this effort. I think that means i would need the integrations bit (e.g. the glfw+opengl backend, though others may want to use one of the other backends). Is that something you envision providing? I guess they can't simply be autogenerated since one would have to mix and match a bit (like a C++ consumer of dear imgui would include imgui_impl_glfw.cpp/.h and imgui_impl_opengl3.cpp/.h in their program)? Or should this instead be converted to pure Python somehow? On a related note, i would also be cool to convert the demo window to pure python, so the whole autogenerated lib can be tested there, visually.

Lastly, for the future, this nicely makes it relatively easy to wrap other libraries like you show with implot. It might be worth thinking about how that can be scalably provided, if you are interested. That people could add imnodes, one of the various file dialogues, etc. Perhaps through syntax like pip install lg_imgui_bundle[imgui,implot,imnodes,xxx], selecting which they want. This repo can then provide the various submodules, kinda like vcpkg does. I'm viewing this from a high level, i'm not familiar with the intricacies of how to achieve that. Worth thinking about though, i think.

Thanks for the great and interesting work!

Will ImPlotPlot struct fields be added to the python bindings in the future?

Hi,
first of all thanks for such a great work on porting (and packaging) Imgui and co. to python. I was playing with Implot in python and wanted to access the current plot data between BeginPlot and EndPlot. That's when I've noticed that there are no python bindings to access the fields of the Plot structure but only bindings for the struct methods

struct ImPlotPlot
{
    ImGuiID              ID;
    ImPlotFlags          Flags;
    ImPlotFlags          PreviousFlags;
    ImPlotLocation       MouseTextLocation;
    ImPlotMouseTextFlags MouseTextFlags;
    ImPlotAxis           Axes[ImAxis_COUNT];
    ImGuiTextBuffer      TextBuffer;
    ImPlotItemGroup      Items;
    ImAxis               CurrentX;
    ImAxis               CurrentY;
    ImRect               FrameRect;
    ImRect               CanvasRect;
    ImRect               PlotRect;
    ImRect               AxesRect;
    ImRect               SelectRect;
    ImVec2               SelectStart;
    int                  TitleOffset;
    bool                 JustCreated;
    bool                 Initialized;
    bool                 SetupLocked;
    bool                 FitThisFrame;
    bool                 Hovered;
    bool                 Held;
    bool                 Selecting;
    bool                 Selected;
    bool                 ContextLocked;

Are you planning on adding bindings for the fields in the future? Is there something that's preventing this from happening? Should I give it a try myself and submit a PR?

The motivation would be that I want to implement a different plot UpdateInput behaviour for my plot and for that I need to access the plot inner components

ImGuiStyle::Colors (and other arrays) not accessible from python bindings

In the app i'm porting, I manually modify the default style by modifying the values in the ´ImGuiStyle::Colors (imgui.get_style().colors` in pyimgui). This doesn't seem to exist in your port. How do i set specific colors/modify my current style?

Same for KeysDown (should be imgui.get_io().keys_down) and a bunch of other arrays in the ImGuiIO struct. As these have known size, i guess there is a bigger chance they may be wrappable?

haiku heart demo hidpi

the height of the plot window is too small, making it very horizontally stretched. Also, when making the window wider, the plot stretches horizontally with the window, but not vertically even though there is plenty of space, making it even more horizontally stretched out.

Heatmap Demo

Not sure how to do a PR with the auto-generator, so I thought i would leave this here.

image

Minimal example:

from imgui_bundle import imgui, immapp, implot
import numpy as np


def gui():
    imgui.text("Hello, heatmap!")
    x = np.linspace(-4,4, 401)
    xx = np.outer(x,x)
    yy = np.sinc(xx)
    rows,cols = yy.shape
    n_ticks = 5
    x_ticks = y_ticks =[str(x) for x in np.linspace(-4,4,n_ticks)]

    axis_flags = implot.AxisFlags_.lock | implot.AxisFlags_.no_grid_lines | implot.AxisFlags_.no_tick_marks
    cmap = implot.Colormap_.viridis
    implot.push_colormap(cmap)
    imgui.begin_group()
    if implot.begin_plot("Sinc Function",[imgui.get_content_region_avail().x -70,-1],implot.Flags_.no_legend | implot.Flags_.no_mouse_text):
        implot.setup_axes(None,None, axis_flags, axis_flags)
        implot.setup_axis_ticks(implot.ImAxis_.x1,0,1,n_ticks,x_ticks,False)
        implot.setup_axis_ticks(implot.ImAxis_.y1,0,1,n_ticks,y_ticks,False)
        implot.plot_heatmap("##heatmap", yy, rows, cols, yy.min(), yy.max(), None, [0,1],[1,0],0)
        implot.end_plot()
    imgui.end_group()
    imgui.same_line()
    implot.colormap_scale("##heatmap_scale",yy.min(),yy.max(),imgui.ImVec2(60,-1),"%g", 0,cmap)
    implot.pop_colormap()



immapp.run(
    gui_function=gui,  # The Gui function to run
    window_title="Hello Heatmap",  # the window title
    window_size_auto=True,  # Auto size the application window given its widgets
    # Uncomment the next line to restore window position and size from previous run
    # window_restore_previous_geometry==True
    with_implot=True
)

And the bindings:

m.def("setup_axis_ticks", 
    [](ImAxis axis, double v_min, double v_max, int n_ticks, std::vector<std::string> labels, bool keep_default=false)
    {
        std::vector<const char*> label_char;
        for (std::string const& str : labels){
            label_char.push_back(str.data());
        }
        ImPlot::SetupAxisTicks(axis, v_min, v_max, n_ticks, label_char.data(), keep_default);
    }, py::arg("axis"), py::arg("v_min"), py::arg("v_max"), py::arg("n_ticks"), py::arg("labels"), py::arg("keep_default"),
    "Sets an axis' ticks and optionally the labels for the next plot. To keep the default ticks, set #keep_default=true."
    );

    m.def("plot_heatmap",
        [](const char * label_id, const py::array & values, int rows, int cols, double scale_min = 0, double scale_max=0, const char * label_fmt="%.1f", const ImPlotPoint& bounds_min=ImPlotPoint(0,0), const ImPlotPoint& bounds_max=ImPlotPoint(1,1), ImPlotHeatmapFlags flags = 0)
        {
            auto PlotHeatmap_adapt_c_buffers = [](const char * label_id, const py::array & values, int rows, int cols, double scale_min = 0, double scale_max=0, const char * label_fmt="%.1f",  const ImPlotPoint& bounds_min=ImPlotPoint(0,0), const ImPlotPoint& bounds_max=ImPlotPoint(1,1),  ImPlotHeatmapFlags flags = 0)
            {
                // convert py::array to C standard buffer (const)
                const void * values_from_pyarray = values.data();

                #ifdef _WIN32
                using np_uint_l = uint32_t;
                using np_int_l = int32_t;
                #else
                using np_uint_l = uint64_t;
                using np_int_l = int64_t;
                #endif
                // call the correct template version by casting
                char values_type = values.dtype().char_();
                if (values_type == 'B')
                    ImPlot::PlotHeatmap(label_id, static_cast<const uint8_t *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'b')
                    ImPlot::PlotHeatmap(label_id, static_cast<const int8_t *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'H')
                    ImPlot::PlotHeatmap(label_id, static_cast<const uint16_t *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'h')
                    ImPlot::PlotHeatmap(label_id, static_cast<const int16_t *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'I')
                    ImPlot::PlotHeatmap(label_id, static_cast<const uint32_t *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'i')
                    ImPlot::PlotHeatmap(label_id, static_cast<const int32_t *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'L')
                    ImPlot::PlotHeatmap(label_id, static_cast<const np_uint_l *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'l')
                    ImPlot::PlotHeatmap(label_id, static_cast<const np_int_l *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'f')
                    ImPlot::PlotHeatmap(label_id, static_cast<const float *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'd')
                    ImPlot::PlotHeatmap(label_id, static_cast<const double *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'g')
                    ImPlot::PlotHeatmap(label_id, static_cast<const long double *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                else if (values_type == 'q')
                    ImPlot::PlotHeatmap(label_id, static_cast<const long long *>(values_from_pyarray), rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
                // If we reach this point, the array type is not supported!
                else
                    throw std::runtime_error(std::string("Bad array type ('") + values_type + "') for param values");
            };

            PlotHeatmap_adapt_c_buffers(label_id, values,  rows, cols, scale_min, scale_max, label_fmt, bounds_min, bounds_max, flags);
        },     py::arg("label_id"), py::arg("values"), py::arg("rows"), py::arg("cols"), py::arg("scale_min")= 0 , py::arg("scale_max") = 0, py::arg("label_fmt")="%.1f", py::arg("bounds_min")= (0,0), py::arg("bounds_max")=(1,1),py::arg("flags")=0 );

~Nick

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.