我已经使用
接下来,我使用PyInstaller将我的应用程序转换为一个文件:
在左侧是来自PyCharm的代码,右侧是来自一个文件(pyinstaller.exe --onefile --windowed opc.py --name myapps)的代码。为什么不一样? 我想要*.png图标,因为它是透明的。
self.setWindowIcon(QtGui.QIcon('icon.png'))
为我的PyQt应用程序设置了图标,当我在PyCharm中运行代码时,它可以正常工作。接下来,我使用PyInstaller将我的应用程序转换为一个文件:
pyinstaller.exe --onefile --windowed opc.py --name myapps
然而,当运行可执行文件时,图标不显示。我做错了什么?
在左侧是来自PyCharm的代码,右侧是来自一个文件(pyinstaller.exe --onefile --windowed opc.py --name myapps)的代码。为什么不一样? 我想要*.png图标,因为它是透明的。
.png
文件捆绑到可执行文件中,以实现您想要的效果。链接的答案应该可以解决问题。 - mfitzp