Python cx-freeze shortcut icon

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Python cx-freeze shortcut icon



I use cx-freeze to distrute an application by making a msi install file. In the setup.py script I specify the shortcut which needs to be placed on the desktop. However the shortcuts icon is blank. The setup.py contains the following code. What am I doing wrong?


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

....





Not really sure. But since it's been 2 days and no responses, have you checked that you don't need a backslash on this line? "[TARGETDIR]photonsters.ico". Also, the 'Icon' field is actually 'Icon_' in the Windows Installer documentation, i.e it's a foreign key into a table called 'Icon'. docs.microsoft.com/en-us/windows/desktop/msi/icon-table
– Captain_Planet
Jul 30 at 7:12




2 Answers
2



Thx, this solved my problem! A snippet of my code:



Shortcuttable:


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:


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",)]
)



Have you tried to:


icon


Executable



remove the backslash in the Target of your shortcut_table, and remove the Iconand IconIndex entries?


Target


shortcut_table


Icon


IconIndex


import ...

....
shortcut_table = [
("DesktopShortcut", # Shortcut
"DesktopFolder", # Directory_
"PhotonFileEditor", # Name
"TARGETDIR", # Component_
"[TARGETDIR]PhotonEditor.exe", # Target
None, # Arguments
None, # Description
None, # Hotkey
None, # Icon
None, # 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

executables = [Executable(....,
icon='photonsters.ico')]

....

setup(....,
executables=executables)



Have you checked that the icon file photonsters.ico is present in the build_dir directory after the build step?


photonsters.ico


build_dir






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered