我使用 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/