Python Forum
[PyQt] Pixmap Dosnt always load
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Pixmap Dosnt always load
#2
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:

def rancard1(self):
	pixmap = random.choice(self.cards)
	self.card1 = QtGui.QIcon(pixmap)
	print(pixmap.isNull())  # Debugging
	...

Hope this helps
Reply


Messages In This Thread
Pixmap Dosnt always load - by jimmyvegas29 - Feb-17-2019, 03:00 AM
RE: Pixmap Dosnt always load - by Alfalfa - Feb-17-2019, 04:11 AM
RE: Pixmap Dosnt always load - by jimmyvegas29 - Feb-17-2019, 02:13 PM
RE: Pixmap Dosnt always load - by jimmyvegas29 - Feb-17-2019, 03:41 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020