Python bindings #45
Replies: 5 comments 10 replies
-
@pthom provided the following example in #43 from imgui_bundle import imgui, immapp, implot3d
import numpy as np
def demo3d_lineplots():
xs1 = np.linspace(0, 1, 1001)
ys1 = 0.5 + 0.5 * np.cos(50 * (xs1 + imgui.get_time() / 10))
zs1 = 0.5 + 0.5 * np.sin(50 * (xs1 + imgui.get_time() / 10))
xs2 = np.linspace(0, 1, 20)
ys2 = xs2 * xs2
zs2 = xs2 * ys2
if implot3d.begin_plot("Line Plots"):
implot3d.setup_axes("x", "y", "z")
implot3d.plot_line("f(x)", xs1, ys1, zs1)
implot3d.set_next_marker_style(implot3d.Marker_.circle.value)
implot3d.plot_line("g(x)", xs2, ys2, zs2, implot3d.LineFlags_.segments.value)
implot3d.end_plot()
immapp.run(demo3d_lineplots, with_implot3d=True) I tried testing it locally following these commands: python -m venv .env
source .env/bin/activate.fish
pip install imgui-bundle
pip install opencv-python
pip install pyGLM
python imgui_bundle.py However, I got the following error: Traceback (most recent call last):
File "/home/breno/Downloads/bundle-test/imgui_bundle.py", line 1, in <module>
from imgui_bundle import imgui, immapp, implot3d
File "/home/breno/Downloads/bundle-test/imgui_bundle.py", line 1, in <module>
from imgui_bundle import imgui, immapp, implot3d
ImportError: cannot import name 'imgui' from partially initialized module 'imgui_bundle' (most likely due to a circular import) (/home/breno/Downloads/bundle-test/imgui_bundle.py) Here is the annotated-types==0.7.0
glfw==2.8.0
imgui-bundle==1.6.1
munch==4.0.0
numpy==2.2.1
opencv-python==4.10.0.84
pillow==11.1.0
pydantic==2.10.4
pydantic_core==2.27.2
PyGLM==2.7.3
PyOpenGL==3.1.7
typing_extensions==4.12.2 Let me know if I did something wrong! I would love to test the python bindings :) |
Beta Was this translation helpful? Give feedback.
-
We can discuss in this thread about the potential API change for ImPlot3D. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
ImGui Bundle v1.6.2 is out and includes ImPlot3D: |
Beta Was this translation helpful? Give feedback.
-
@pthom thank you soooo much for adding ImPlot3D to imgui-bundle! I'll be closing this discussion now (we can reopen it if you feel the need 🙂) |
Beta Was this translation helpful? Give feedback.
-
@pthom did some amazing work in imgui_bundle to create python bindings for ImPlot3D.
The discussion about imgui_bundle started in #43 and was moved here to better track the feature progress and potential changes to the ImPlot3D API.
Thanks for the heavy work @pthom!
Beta Was this translation helpful? Give feedback.
All reactions