【问题标题】:Add icon to a cx_Freeze script将图标添加到 cx_Freeze 脚本
【发布时间】:2021-01-22 14:42:46
【问题描述】:

如何为使用 cx_Freeze 制作的可执行文件添加图标? 我在 google 和 stackoverflow 上寻找解决方案,但找不到任何解决方案。

这是我的setup.py

import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"includes": ["tkinter"]}

# GUI applications require a different base on Windows (the default is for
# a console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "YouTube-Video-Downloader",
        version = "0.1",
        description = "",
        options = {"build_exe": build_exe_options},
        executables = [Executable("app.py", base=base)])

【问题讨论】:

    标签: python icons cx-freeze


    【解决方案1】:

    您可以使用Executableicon 参数向可执行文件添加图标:

    setup(  name = "YouTube-Video-Downloader",
            version = "0.1",
            description = "",
            options = {"build_exe": build_exe_options},
            executables = [Executable("app.py", base=base, icon="path_to_icon_file")])
    

    给定的图标文件必须是适用于 Windows 的有效图标文件。另请参阅cx_Freeze documentation

    【讨论】:

      猜你喜欢
      • 2012-05-18
      • 2013-12-06
      • 1970-01-01
      • 2019-07-05
      • 2019-11-20
      • 1970-01-01
      • 1970-01-01
      • 2020-12-21
      相关资源
      最近更新 更多