[英]How to add an icon to a cx_Freeze executable?
I have looked at previous question that address this issue and I am very sure I have implemented the code correctly.我已经查看了解决此问题的上一个问题,并且我非常确定我已经正确实现了代码。 Whenever I run the "build_msi" command on my setup script it only creates a build folder that is empty inside.
每当我在安装脚本上运行“build_msi”命令时,它只会创建一个内部为空的构建文件夹。 Whenever I remove the icon parameter from the Executable function the installer builds correctly.
每当我从 Executable 函数中删除 icon 参数时,安装程序就会正确构建。 This is the code.
这是代码。
from cx_Freeze import Executable, setup
executables = [Executable("FlappyBird.py", base = 'Win32GUI', shortcutName = 'Flappy Bird', shortcutDir = 'DesktopFolder', icon = 'Icon.ico')]
Packages = ['pygame']
Options = {
'build_exe': {
'packages': Packages,
'include_files': ['BackgroundBottom.png', 'BackgroundTop.png', 'BottomPipe.png', 'FlappyBirdFlat.png', 'TopPipe.png']
},
}
setup(
name = "Flappy Bird",
options = Options,
executables = executables
)
This is the output这是输出
running bdist_msi
running build
running build_exe
creating directory build\exe.win-amd64-3.6
copying C:\Program Files\Python36\lib\site-packages\cx_Freeze\bases\Win32GUI.exe -> build\exe.win-amd64-3.6\FlappyBird.exe
copying C:\Program Files\Python36\python36.dll -> build\exe.win-amd64-3.6\python36.dll
Your Icon.ico
is probably not a valid .ico
file.您的
Icon.ico
可能不是有效的.ico
文件。 I can reproduce the behavior you describe by using for example an empty text file renamed to Icon.ico
.我可以通过使用例如重命名为
Icon.ico
的空文本文件来重现您描述的行为。
Try with a valid .ico
file.尝试使用有效的
.ico
文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.