Changing the icon of the produced .exe, py2exe

13,167

I've had this problem before (though I'm using windows XP). A recent snippet of code that worked for me:

from distutils.core import setup

setup(
    options = {'py2exe': {'bundle_files': 1}},
    zipfile = None,
    windows = [{
            "script":"myprogram.pyw",
            "icon_resources": [(1, "myicon.ico")],
            "dest_base":"myprogram"
            }],
)

This creates one .exe file that you can use to distribute (even includes windows libs -- so use caution there)

My .ico file was 64 x 64 and I used a tool to create it from a JPG (something like http://www.favicon.cc/) Sometimes with Photoshop and GIMP saving a file as .ico with default settings is not quite enough, so be aware you might have to do something else there.

Share:
13,167
thelost
Author by

thelost

just for fun

Updated on September 15, 2022

Comments

  • thelost
    thelost over 1 year

    Ive been googling this however none of the results worked for me.

    Here is my setup file

    setup(
    windows = [
        {
            "script": "start.py",
            "icon_resources": [(1, "myicon.ico")]
        }
    ],
    )
    

    The icon of the actual .exe file should be "myicon.ico". However this does not happen and is the default icon. "myicon.ico" is 32 x 32.

    I am using windows 7.