Reputation: 1228
First of all, I have use Qt Designer to turn a picture into a .qrc file, Then I use pyrcc4 to turn this .qrc file into a .py resource.
pyrcc4 qrcfile.qrc -o pyfile.py
then import this .py file in my .py file. but after build with pyinstaller this resouce file does not work.
pyinstaller -F my_code.py
How to import resource file in PyQt and build with pyinstaller?
Upvotes: 0
Views: 3012
Reputation: 1228
QRC file is an XML file that looks like below:
<RCC>
<qresource prefix="/images">
<file alias='filename.jpg'>images/filename.jpg</file>
</qresource>
</RCC>
use it in .py file should be like this:
pixmap = QPixMap(':/images/filename.jpg')
Upvotes: 1