Feb-17-2019, 04:11 AM
You might want to create all the pixmap objects on init and store them in a list (self.cards), so QPixmap() will be called only once on each image. Then try creating fresh QIcon instance by loading the pixmap directly:
Hope this helps
def rancard1(self): pixmap = random.choice(self.cards) self.card1 = QtGui.QIcon(pixmap) print(pixmap.isNull()) # Debugging ...
Hope this helps