The documentation for PyQt6 states that
Support for Qt’s resource system has been removed (i.e. there is no
pyrcc6
).
In light of this, how should one provide resources for a PyQt6 application?
There has been some discussion on the PyQt mailing list when this was found out.
The maintainer is not interested in maintaining pyrcc anymore as he believes that it doesn't provide any major benefit considering that python already uses multiple files anyway.
The easiest solution is probably to use the static methods of QDir setSearchPaths()
or addSearchPath()
.
The difference will be that resources will be loaded using the prefix used for the methods above.
Considering the previous situation:
icon = QtGui.QIcon(':/icons/myicon.png')
Now it would become like this:
# somewhere at the beginning of your program
QtCore.QDir.addSearchPath('icons', 'path_to_icons/')
icon = QtGui.QIcon('icons:myicon.png')