setting icon using py2exe?

Chris Liechti cliechti at gmx.net
Tue Jun 29 23:30:52 CEST 2004


Grant Edwards <grante at visi.com> wrote in
news:slrnce3gcc.89j.grante at grante.rivatek.com: 

> I'm trying in vain to set the icon for the executable generated
> by py2exe.  According to various sources there are two answers:
> 
>  1) Do it on the command line:
> 
>        python setup.py py2exe --icon foo.ico
> 
>     That generates a usage error:
>        
>        error: --icon not recognized

that is for versions < 0.4
it is not longer supported in 0.5+

>  2) According to
>  http://starship.python.net/crew/theller/moin.cgi/CustomIcons 
>     you can set the icon_resources in the setup.py like this:
> 
>       # setup.py
>       from distutils.core import setup
>       import py2exe
>       setup(windows=[{"script":"vfcupdate.py","icon_resources":[(1,"riv
>       atek.ico")]}]) 
...
>       RuntimeError: MapExistingFile: The handle is invalid.
>       
> Has anybody really been able to set the icon for the executable
> generated by py2exe?

yes, works fine here:
    windows = [
        { 'script': "hexedit_wx.py",  'icon_resources': [(0x0004, 
'bigicon.ico')]},
    ],
       
i was told that the ID does not matter that much, it will just take the 
first icon resource. i somewhere saw the use of 4, so i tested with that 
number and since it worked for me, i didn't change it

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list