Skip to content

Usage with glfw - imgui #260

Closed
Closed

Description

@mbignotti

Hi!
Are there any examples about the usage with glfw?
I'm trying to understand if I can use fastplotlib with https://github.com/pthom/imgui_bundle (that relies on glfw).

Thanks a lot!

Activity

  1. kushalkolar commented on Jun 24, 2023

    @kushalkolar
    Member

    Hi! Thanks for your interest! I am also interested in integrating this with imgui, see this recent dicussion: pyimgui/pyimgui#336

    I just pushed a new release which contains a small fix to make the minimal install work: https://github.com/kushalkolar/fastplotlib#minimal-use-with-your-own-qt-or-glfw-applications

    You will need to pip install glfw in addition to that.

    For examples using glfw, use any of the desktop examples here:
    https://github.com/kushalkolar/fastplotlib/tree/master/examples/desktop

    Give the kwarg canvas="glfw" when constructing a Plot or GridPlot to force glfw. Don't forget to call fpl.run() at the end.

    For example with image_simple.py: https://github.com/kushalkolar/fastplotlib/blob/master/examples/desktop/image/image_simple.py

    from fastplotlib import Plot, run
    import imageio.v3 as iio
    
    # force glfw
    plot = Plot(canvas="glfw")
    
    data = iio.imread("imageio:camera.png")
    
    # plot the image data
    image_graphic = plot.add_image(data=data, name="iio camera")
    
    plot.show()
    
    plot.canvas.set_logical_size(800, 800)
    
    plot.auto_scale()
    
    # show and run
    plot.show()
    run()

    You can also use the example notebooks and pass canvas="glfw" to Plot or GridPlot and it will use the glfw canvas without blocking notebook executation.

  2. mbignotti commented on Jun 26, 2023

    @mbignotti
    Author

    Hi @kushalkolar!
    Thanks a lot for your answer!
    Your example works fine!
    I'll let you know if I manage to make it work with imgui-bundle, which is a batteries-included version of pyimgui.

    Thank you!

  3. kushalkolar commented on Jun 26, 2023

    @kushalkolar
    Member

    My guess is that imgui integration would probably be done with wgpu-py and pygfx, since fastplotlib is built on top of pygfx.

    See related discussion: pyimgui/pyimgui#336

    I don't have experience with imgui, very interested to see what you find out!

  4. kushalkolar commented on Oct 24, 2023

    @kushalkolar
    Member

    @mbignotti wondering if you were able to try this out?

  5. mbignotti commented on Oct 24, 2023

    @mbignotti
    Author

    Hey @kushalkolar,
    I'm really sorry, but I stopped working on the imgui project a few weeks after I opened this issue and I totally forgot to reply here. My apologies!
    Unfortunately I haven't had the chance to try it out. The original idea was trying to mimic what is being done in this fantastic series (at a much simpler level, of course), but with numpy, numba and imgui. Then I thought I could try use fastplotlib to display the image in real time.
    Unfortunately, other priorities had arrived in the mean time, and I abandoned the project. Sorry again.

  6. kushalkolar commented on Oct 24, 2023

    @kushalkolar
    Member

    Thanks for the update! Creating viewports/subplots in a drag-drop-resize fashion would be really cool. I might just try and learn ImGUI soon and try to do it myself, but it has been years since I've touched C++ and my C++ abilities are very basic.

  7. mbignotti commented on Oct 25, 2023

    @mbignotti
    Author

    I don't think that using C++ is necessary here. The python bindings provide the same functionalities. However, I don't know if fastplotlib can be used to display an image inside an imgui window.

  8. kushalkolar commented on Jul 30, 2024

    @kushalkolar
    Member

    Hi, this is finally being worked on in #571

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions