.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/guis/imgui_floating.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__gallery_guis_imgui_floating.py: ImGUI floating windows ====================== You can add floating and fixed-extent imgui windows that are overlaid on the Figure. .. GENERATED FROM PYTHON SOURCE LINES 7-39 .. image-sg:: /_gallery/guis/images/sphx_glr_imgui_floating_001.webp :alt: imgui floating :srcset: /_gallery/guis/images/sphx_glr_imgui_floating_001.webp :class: sphx-glr-single-img .. code-block:: Python # test_example = false import numpy as np import fastplotlib as fpl from imgui_bundle import imgui figure = fpl.Figure(size=(700, 560)) figure[0, 0].add_image(np.random.rand(128, 128), name="image") # a floating window is auto-sized by imgui and can be dragged by the user @figure.add_imgui_window(location="floating", title="floating", window_flags=imgui.WindowFlags_.none) def floating_gui(fig): if imgui.button("randomize"): fig[0, 0]["image"].data = np.random.rand(128, 128) # a window fixed to a fractional extent (xmin, xmax, ymin, ymax) of the canvas @figure.add_imgui_window(extent=(0.6, 0.98, 0.05, 0.25), title="fixed") def fixed_gui(): imgui.text("fixed to a\nfractional extent") figure.show() # NOTE: fpl.loop.run() should not be used for interactive sessions # See the "JupyterLab and IPython" section in the user guide if __name__ == "__main__": print(__doc__) fpl.loop.run() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.145 seconds) .. _sphx_glr_download__gallery_guis_imgui_floating.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: imgui_floating.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: imgui_floating.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_