0

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?

CrApHeR
  • 2,595
  • 4
  • 25
  • 40
caimaoy
  • 1,148
  • 1
  • 11
  • 25

1 Answers1

1

see this answer

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')
Community
  • 1
  • 1
caimaoy
  • 1,148
  • 1
  • 11
  • 25