I\'m having trouble importing a resource file. I\'m using pyqt4 with monkey studio and I am trying to import a png image. When I run the program I get an import error like
its because when you also used pyuic5 to convert your UI to py, the resource file name from the UI sticks.
then use
Pyrcc5 input_file.qrc -o icons.py
remove from main_script.py
import icon_rc
and use
import icons
the when calling the actual icons from the icons module, you have to look at your qrc file prefix.
< RCC >
< qresource
prefix = "ico5" >
< file > plugin.png < / file >
< / qresource >
< / RCC >
if prefix is ico5 then you load icons with
QtGui.QIcon(":/ico5/plugin.png")
and if prefix is , lets say,
then its:
QtGui.QIcon(":/icons/plugin.png")