I'm a beginner in coding and python. I read that tkinter is a bit to "basic" if you want to develop an application which is a a bit more complicated and PyQt is problematic for licencing. This is why I chose PySide2 in order to develop this kind of project, but found so far the documentation relatively scarce. Is this the right choice?
My present coding problem is the following: I'm Trying to load an image with PySide2 without success. Here is the code of my 2 attempts:
Attempt N°1:
import sys
import PySide2
from PySide2.QtWidgets import QApplication, QLabel
app = QApplication(sys.argv)
img = PySide2.QtGui.QImage("/Users/mymac/Downloads/ecg_measure.png")
pixmap=PySide2.QtGui.QPixmap(img)
label = PySide2.QtWidgets.QLabel.setPixmap(pixmap)
label.show()
app.exec_()
I get the following message:
Traceback (most recent call last):
File "<ipython-input-1-86961df4959d>", line 8, in <module>
label = PySide2.QtWidgets.QLabel.setPixmap(pixmap)
TypeError: descriptor 'setPixmap' requires a 'PySide2.QtWidgets.QLabel' object but received a 'PySide2.QtGui.QPixmap'
Using the information in the Traceback, I tried the following Attempt N°2:
import sys
import PySide2
from PySide2.QtWidgets import QApplication, QLabel
app = QApplication(sys.argv)
img = PySide2.QtGui.QImage("/Users/mymac/Downloads/ecg_measure.png")
pixmap=PySide2.QtGui.QPixmap(img)
lab=PySide2.QtWidgets.QLabel(pixmap)
PySide2.QtWidgets.QLabel.setPixmap(lab)
app.exec_()
I get the following errror message:
Traceback (most recent call last):
File "<ipython-input-1-61b41e4b2f63>", line 8, in <module>
lab=PySide2.QtWidgets.QLabel(pixmap)
TypeError: 'PySide2.QtWidgets.QLabel' called with wrong argument types:
PySide2.QtWidgets.QLabel(PySide2.QtGui.QPixmap) Supported signatures:
PySide2.QtWidgets.QLabel(PySide2.QtWidgets.QWidget = None,
PySide2.QtCore.Qt.WindowFlags = Qt.WindowFlags())
PySide2.QtWidgets.QLabel(unicode, PySide2.QtWidgets.QWidget = None, PySide2.QtCore.Qt.WindowFlags = Qt.WindowFlags())