12
« on: August 26, 2021, 07:36:16 AM »
Hello everybody,
can someone please tell me how to show a small picture in a GUI?
I made some GUIs with PySide2 but I don't know how to load a fixed picture to them.
It must have to do with QPixmap ?!
from PySide2 import QtCore, QtGui, QtWidgets
class ref_korr_gui(QtWidgets.QDialog):
def __init__ (self, parent):
QtWidgets.QDialog.__init__(self, parent)
doc = Metashape.app.document
chunk = doc.chunk
self.setWindowTitle("Ref.-Korr.")
image_path = "D:\Dropbox\Showreel\16 Markerplatten\Zusatzsoftware\Korrektur.jpg"
picture = QtGui.QPixmap(image_path)
self.label = QtWidgets.QLabel()
self.label.setPixmap(picture)
self.label.setGeometry(QtCore.QRect(10, 40, picture.width(), picture.height()))
...
layout = QtWidgets.QGridLayout()
layout.addWidget(self.label, 11,1)
self.setLayout(layout)
self.exec()
If I print(picture.width()) it is "0" ... But why?