pyvista-imgui
is a small helper module for the pyvista
-package to integrate it with the imgui-library.
It integrates a fully interactive pyvista
-Plotter as an imgui-widget, by utilizing VTK's vtkGenericOpenGLRenderWindow
to first render the output into an OpenGL texture and displaying it as a regular imgui-image widget.
It currently utilizes either the bindings provided by imgui-bundle
, or by pyimgui
.
This package is considered experimental at this moment, so expect issues.
To install this package using pip
use:
pip install pyvista-imgui[imgui-bundle]
for the imgui-bundle
bindings or:
pip install pyvista-imgui[imgui]
for the pyimgui
bindings.
Alternatively the installation from source is also possible with:
git clone https://github.com/mortacious/pyvista-imgui
cd pyvista-imgui
pip install [-e] .[imgui-bundle / imgui]
The package includes the class ImguiPlotter
, which can be used as a drop-in alternative to the regular pyvista
-plotters:
import pyvista as pv
from pyvista_imgui import ImguiPlotter
sphere = pv.Sphere()
plotter = ImguiPlotter()
plotter.add_axes()
plotter.add_mesh(sphere)
plotter.show()
Alternatively, an instance of ImguiPlotter
can be integrated into an existing imgui-UI as a widget:
imgui.begin("Imgui Plotter")
# render the plotter's contents here
plotter.render()
imgui.end()