Question

this is my qrc_resources.qrc file

<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file alias="fault.png">images/fault.png</file>
<file alias="schedule.png">images/schedule.png</file>
<file alias="inventory.png">images/inventory.png</file>
<file alias="setting.png">images/setting.png</file>
<file alias="test.png">images/test.png</file>
<file alias="te.png">images/fault.png</file>
<file alias="local.png">images/local.png</file>
<file alias="newfault.png">images/newfault.png</file>
<file alias="newschedule.png">images/newschedule.png</file>
<file alias="viewschedule.png">images/viewschedule.png</file>
<file alias="lock.png">images/lock.png</file>
</qresource>
</RCC>

this is my pyqt code

newfault = QtGui.QPushButton(QtGui.QIcon(":\newfault.png"),"Add \nNew Fault")
newfault.setIconSize(QtCore.QSize(30,30))      
viewfault = QtGui.QPushButton(QtGui.QIcon(":\viewfault.png"),"View Faults")
viewfault.setIconSize(QtCore.QSize(30,30))

but the images doesn't show up in the QPush Button. What is causing the problem?

FYI, i did import qrc_resources file and not all the png files are missing.If i use some of the images in resource file (for example, settings.png) it showed up on the button. If i use fault.png,test.png, nothing show up.

enter image description here

Was it helpful?

Solution

my bad! i was using :\ to import from qrc_resources. In fact, i have to use :/ .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top