setPixmap called with wrong arguments, but arent they the right arguments?
-
I'm trying to call setPixmap(pm) where pmis a QImage, however pyqt throws the following error. I dont understand whats wrong, it said it expected an of these: Union[QPixmap, QImage, str] and I provided a QImage.
-
@IDontKnowHowToCode
Trying to callsetPixmap()
on what? We don't know what yourself.trackedImage
is, and you don't say. From the tracebcak it looks like it is aQLabel
. And in the Qt6 C++ documentation at https://doc.qt.io/qt-6/qlabel.html#pixmap-prop I see onlysetPixmap(const QPixmap &)
and same at https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QLabel.html#PySide6.QtWidgets.PySide6.QtWidgets.QLabel.setPixmap, the PySide6 error message aboutUnion
notwithstanding.Try converting your
QImage
to aQPixmap
and see? -
Which version of PySide6 are you using? we recently enable PathLike objects to the QClipboard.setPixmap and setImage https://codereview.qt-project.org/c/pyside/pyside-setup/+/491315 but QLabel.setPixmap should get a Pixmap, not an QImage. There might be a bug on the signature, so I encourage you to file a report https://wiki.qt.io/Qt_for_Python/Reporting_Bugs