Search code examples
pythoncx-freeze

How to display icon in uninstall list of programs using python cx_Freeze?


I am able to build a MSI to my application and it works fine but the icon in control panel--> uninstall a program--> my-application is missing.

enter image description here

How to make custom setup.py file to display the icon?

I tried to include the icon in the setup file as below but it is displayed only at the MyProgramMenu:

exe = Executable( 
    script="test.py", 
    initScript=None,
    base=base,  
    targetName="test.exe", 
    copyDependentFiles=True,
    compress=False,
    appendScriptToExe=False,
    appendScriptToLibrary=False,
    shortcutDir="MyProgramMenu",
    shortcutName=APP_NAME,
    icon="test.ico" 
)

I want to display the icon in the list of programs in the control panel.


Solution

  • I think there is no easy and clean way using:

    python setup.py bdist_msi
    

    as you would basically need to do the extra step described in Set the icon displayed in Add/Remove Programs which would require to patch distutils\command\bdist_msi.py in a probably non-generic way.

    To make a more customizable installer with proper uninstall icon, you can use script-based tools such as NSIS (Nullsoft Scriptable Install System). Perform only the build step with cx_Freeze:

    python setup.py build
    

    and run the installer-generating script of NSIS or any other tool you chose afterwards.