Skip to content

Embedding in PyQt #340

Closed
Closed
@joeyo

Description

@joeyo

Here is a minimal example example that should work with Qt:

import fastplotlib as fpl
plot = fpl.Plot(canvas="qt")
plot.show()

if __name__ == "__main__":
    fpl.run()

With these packages installed:

wgpu==0.11.0
pygfx==0.1.15
fastplotlib==0.1.0a13
PyQt6==6.5.3

the following error message is generated (similar errors occur with PyQt5, PySide2, and PySide6):

Traceback (most recent call last):
  File "/Users/joeyo/src/bmi/analysis/joeyo/fpl/qt_minimal.py", line 3, in <module>
    plot = fpl.Plot(canvas="qt")
  File "/opt/homebrew/lib/python3.10/site-packages/fastplotlib/layouts/_plot.py", line 54, in __init__
    super(Plot, self).__init__(
  File "/opt/homebrew/lib/python3.10/site-packages/fastplotlib/layouts/_subplot.py", line 77, in __init__
    canvas, renderer = make_canvas_and_renderer(canvas, renderer)
  File "/opt/homebrew/lib/python3.10/site-packages/fastplotlib/layouts/_utils.py", line 50, in make_canvas_and_renderer
    raise ImportError(
ImportError: The qt framework is not installed for using this canvas

Which suggests that fastplotlib/layouts/_utils.py:17 is raising an ImportError:

16 try:
17    from wgpu.gui.qt import QWgpuCanvas
18 except ImportError:
19    QWgpuCanvas = False

However the following will run without errors:

import PyQt6  # apparently necessary
from wgpu.gui.qt import QWgpuCanvas

Is there some missing import logic?

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy