demo_implot.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Part of ImGui Bundle - MIT License - Copyright (c) 2022-2026 Pascal Thomet - https://github.com/pthom/imgui_bundle
  2. from imgui_bundle import imgui, imgui_md, immapp
  3. from imgui_bundle.demos_python.demos_imgui_explorer import implot3d_demo
  4. from imgui_bundle.demos_python.demos_imgui_explorer import implot_demo
  5. from imgui_bundle.demos_python.demo_utils.imgui_explorer_setup import get_imgui_explorer, get_package_path
  6. imgui_explorer, _has_imgui_explorer = get_imgui_explorer()
  7. def demo_gui():
  8. imgui_md.render_unindented(
  9. """
  10. [Implot](https://github.com/epezent/implot) and [Implot3D](https://github.com/brenocq/implot3d) are fast and efficient libraries which provide immediate Mode Plotting.
  11. """
  12. )
  13. if imgui.collapsing_header("ImPlot: Full Demo"):
  14. if _has_imgui_explorer:
  15. assert imgui_explorer is not None
  16. imgui.push_id("ImPlotDemo")
  17. imgui_explorer.show_imgui_explorer_gui_python(imgui_explorer.ImGuiExplorerLibrary.implot, get_package_path())
  18. imgui.pop_id()
  19. else:
  20. implot_demo.show_all_demos()
  21. if imgui.collapsing_header("ImPlot3D: Full Demo"):
  22. if _has_imgui_explorer:
  23. assert imgui_explorer is not None
  24. imgui.push_id("ImPlot3DDemo")
  25. imgui_explorer.show_imgui_explorer_gui_python(imgui_explorer.ImGuiExplorerLibrary.implot3_d, get_package_path())
  26. imgui.pop_id()
  27. else:
  28. implot3d_demo.show_all_demos()
  29. def main():
  30. immapp.run(demo_gui, with_implot=True, with_implot3d=True, with_markdown=True, window_size=(1000, 800))
  31. if __name__ == "__main__":
  32. main()