Python cx-freeze 快捷方式图标

标签 python windows-installer cx-freeze distutils shortcut-file

我使用 cx-freeze 通过制作 msi 安装文件来破坏应用程序。在 setup.py 脚本中,我指定了需要放置在桌面上的快捷方式。但是快捷方式图标是空白的。 setup.py 包含以下代码。我做错了什么?

import ...
....
shortcut_table = [
    ("DesktopShortcut",                                             # Shortcut
     "DesktopFolder",                                               # Directory_
     "PhotonFileEditor",                                            # Name
     "TARGETDIR",                                                   # Component_
     "[TARGETDIR]\PhotonEditor.exe",                                # Target
     None,                                                          # Arguments
     None,                                                          # Description
     None,                                                          # Hotkey
     "[TARGETDIR]photonsters.ico",                                  # Icon
     0,                                                             # IconIndex
     None,                                                          # ShowCmd
     "TARGETDIR",                                                   # WkDir
     )
]


# Now create the table dictionary
msi_data = {"Shortcut": shortcut_table}
#msi_data = {"Shortcut": shortcut_table, "Icon": icon_table}

# Change some default MSI options and specify the use of the above defined tables
bdist_msi_options = {'data': msi_data}

....

最佳答案

谢谢,这解决了我的问题!我的代码片段:

快捷方式:

shortcut_table = [
("DesktopShortcut", # Shortcut
 "DesktopFolder",   # Directory_
 "PhotonFileEditor",# Name
 "TARGETDIR",   # Component_
 "[TARGETDIR]\PhotonEditor.exe", # Target
 None,              # Arguments
 None,              # Description
 None,              # Hotkey
 "",                # Icon (Use 
 0,                 # IconIndex
 None,              # ShowCmd
 "TARGETDIR",                   # WkDir
 )
]

设置:

setup (  name = "PhotonFileEditor",
         version = "0.1",
         author= "Photonsters",
         url="https://github.com/Photonsters",
         description = "Photon File Editor",
         options = {"build_exe": build_exe_options,"bdist_msi": bdist_msi_options},
         executables = [Executable(script="PhotonEditor.py",       
         base=base,icon="PhotonEditor.ico",)]
 )

关于Python cx-freeze 快捷方式图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51560822/

相关文章:

visual-studio-2013 - Visual Studio 2013 Shell(隔离)安装失败,错误 997 : Overlapped I/O operation is in progress

windows - 具有现代外观和感觉的 WIX 安装程序

windows - 使用 Installshield 16 创建的安装期间自定义操作无法执行

python - cx_freeze 如何编译 Python 脚本?

python - 在 Windows 上将 cx_Freeze 安装到 python

通过重新执行的 Python 对象持久性

python - 在 SciPy 中搜索函数 `LinearNDInterpolator` 的源代码

Python 循环具有极长的运行时间

python - 用逗号匹配 float ,然后用点替换逗号?

python - linux 可执行文件不工作但脚本在 python 中工作