Join date: May 14, 2022


E-Sword Bijbelboeken Nederlands 64 Bit bennnil




ROMANS All translation and editing by Maria van Wouwe, Ed. D. Prof. mr. dr. J. Israëls. translated by Bert van Roermund and edited by Herman A. Hermans.Q: PyQt: Get image from QPixmap into a QLabel I want to get an image from a QPixmap into a QLabel. I can get a gray scale image from a QPixmap but when I want to print the image it prints only white space. def pixmap_to_qlabel(self, pm): lbl = QLabel(pm) lbl.setPixmap(pm.scaled(1200,1200,Qt.IgnoreAspectRatio,Qt.SmoothTransformation)) return lbl How can I print a QPixmap image? I do not know how it should be done. A: You can either read image in pixel data (or RGB color components). Qt core provides such functionality in QImage and QPixmap. You can use setScaledFrom() function in QPixmap to create scaled pixmap image and setScaledFrom() function to specify the size of the scaled image: import sys from PyQt5 import QtCore, QtGui, QtWidgets class MyPixmap(QtWidgets.QLabel): def __init__(self, parent=None): super().__init__(parent) pixmap = QtGui.QPixmap("/path/to/image.png") self.setPixmap(pixmap) self.scale = pixmap.scaled(512, 512, QtCore.Qt.KeepAspectRatio) self.scale.setScaledFrom(0, 0, QtCore.QSize(512, 512)) def paintEvent(self, event): painter = QtGui.QPainter() painter.drawPix





E-Sword Bijbelboeken Nederlands 64 Bit bennnil

More actions