I am using pyqt, icon is added.
icon.addPixmap(QtGui.QPixmap(_fromUtf8("favicon.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
In setup.py for py2exe, I am trying to add my icon to resources.
from distutils.core import setup
import py2exe
setup(
console=[{
"script" : "manage.py",
"icon_resources": [(1, "favicon.ico")]
}],
options={
"py2exe" : {"includes" : ["sip",]}
}
)
When I start my program from IDE as python script, I see my icon. When I create exe program with py2exe, my program works well, but icon dissappears.
The problem is that py2exe doesn't include the qt icon reader plugin. Data_files parameter added.
from distutils.core import setup
import py2exe
setup(
options={
"py2exe" : {"includes" : ["sip",]}
},
data_files = [
('imageformats', [
r'C:\programs\Python271\Lib\site-packages\PyQt4\plugins\imageformats\qico4.dll'
])],
console=[{
"script" : "manage.py"
}]
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With