Closed homosapien-lcy closed 1 year ago
@homosapien-lcy Please can you give some more context? What Python version? What OS? Most importantly, what packages are installed, and what Qt backend are you using? (PySide6? PyQt6? Something else?)
In general, whenever you're reporting a Python error, it's good practice also to include the entire traceback.
Do you have any thoughts about what might be going wrong here, and how to fix it?
Got it, I just updated the package informations. I think maybe the function its looking for has moved to another module. We probably need to search for it.
Okay, so this is PySide6. See the docs here: https://doc.qt.io/qtforpython/PySide6/QtSvgWidgets/QSvgWidget.html. QSvgWidget
should now be imported from QtSvgWidgets
instead of from QtSvg
.
However, that doesn't necessarily mean that the right fix is to change the imports here, since we still want this example to work with backends other than PySide6. Pyface should be providing us with a backend-independent way for us to get QSvgWidget
, so that downstream code can use that regardless of which Qt backend is in use. Please could you open a Pyface issue for this, if necessary?
Okay, so this is PySide6. See the docs here: https://doc.qt.io/qtforpython/PySide6/QtSvgWidgets/QSvgWidget.html.
QSvgWidget
should now be imported fromQtSvgWidgets
instead of fromQtSvg
.However, that doesn't necessarily mean that the right fix is to change the imports here, since we still want this example to work with backends other than PySide6. Pyface should be providing us with a backend-independent way for us to get
QSvgWidget
, so that downstream code can use that regardless of which Qt backend is in use. Please could you open a Pyface issue for this, if necessary?
Got it, I also open this issue in pyface (https://app.zenhub.com/workspaces/ets-queue-priority-64022b3641e35b00166c1272/issues/gh/enthought/pyface/1235) besides making the quick fix.
Thanks! As mentioned before, it's better to use a direct link to other issues, since (a) not everyone viewing this tracker will have zenhub access, and (b) GitHub will create a reverse link on the Pyface issue.
So use: https://github.com/enthought/pyface/issues/1235 instead of the ZenHub URL.
AttributeError: module 'pyface.qt.QtSvg' has no attribute 'QSvgWidget' when python enable/enable/examples/demo/savage/static_image.py
environment: [macOS, python3.11, python3.8 with or without EDM]
Package lists: