Solved [QLabel] PNG/JPG image not showing when running the program
-
[PYTHON 3.8]
I have tried all various solutions other people have had. (Checked tags, googled) and nothing so far.I'm using Open-Source Qt Creator 4.12.3 in Windows 10.
I load image via QLabel pixmap from Resource.qrc file:<RCC> <qresource prefix="/images"> <file>amd_dragon.jpg</file> </qresource> </RCC>
Ignore the titlebar red line. I was about to ask how to change the TitleBar to custom one as well but I'ma google first. Got lots of tabs open to look at.
-
Hi and welcome to devnet,
Did you generate the python resources from your .qrc file ?
Are you importing it in your code somewhere ? -
Did you generate the python resources from your .qrc file? No idea / I don't know what you mean by that :(
Are you importing it in your code somewhere? Nope. Only added code so far to remove the Windows titlebar and customize it with my own.Picture of main.py:
-
Then you should read the Qt for Python qrc file use documentation
-
This helped. Did the command like the documentation said so and imported the file and bam! Very nice!