resource file in PyQt4

痞子三分冷 提交于 2019-11-28 10:11:33

What you see is the byte-by-byte dump of the resources the .qrc file contains. You don't explicitly access the objects inside the module. Just import it, and you will be able to access those resources by their original names(and paths) but preceded by a colon.

pixmap = QPixMap(':/images/filename.jpg')

UPDATE: QRC file is an XML file that looks like below:

<RCC>
  <qresource prefix="/images">
    <file alias='filename.jpg'>images/filename.jpg</file>
  </qresource>
</RCC>

Then to generate it, use:

pyrcc4 -o images_rc.py images.qrc
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!