擅长:python、mysql、java
<p>对于pyqt,必须使用pyrcc4,这相当于python的rcc。</p>
<pre><code>pyrcc4 -o resources.py resources.qrc
</code></pre>
<p>这将生成resources.py模块,该模块需要导入到python代码中,以便使资源可用。</p>
<pre><code>import resources
</code></pre>
<p>要在代码中使用资源,必须使用“:/”前缀:</p>
<p>示例</p>
<pre><code>from PyQt4.QtCore import *
from PyQt4.QtGui import *
import resources
pixmap = QPixamp(":/newPrefix/download.jpeg")
</code></pre>
<p>见<a href="http://pyqt.sourceforge.net/Docs/PyQt4/resources.html" rel="noreferrer">The PyQt4 Resource System</a>和<a href="http://doc.qt.io/qt-5/resources.html" rel="noreferrer">The Qt Resource System</a></p>