I created a package that contains an icon.png
inside a resource-folder:
- ../mypackage/resource/icon.png
- ../mypackage/qtprogram.py
I am now trying to access the icon.png
in qtprogram.py
. As they are both in mypackage
directory, I tried using:
QtGui.QIcon("resource//icon.png")
but it did not work. However, using the full path (in relation to the main script path) did. Since this should be a shareable package, I would like to avoid using the full path. How can I do this?
Path(__file__).parent / 'resource' / 'icon.png'
– musicamante