Ejemplo n.º 1
0
    def addFromBase64(self, data):
        data = b64decode(data)
        label = QLabel(self)
        label.setScaledContents(True)
        self.labels.append(label)
        self.widget_layout.addWidget(label)

        pix = QPixmap()
        pix.loadFromData(data, "PNG")
        pix.scaled(label.width(), label.height(),
                   Qt.KeepAspectRatioByExpanding, Qt.SmoothTransformation)
        label.setPixmap(pix)