Py2exe setup.py with icons

How to create icons for my exe file when compiling my Python program?

+5
source share
4 answers

I searched for this a while ago and found this: http://www.mail-archive.com/ pygame-users@seul.org /msg05619.html

Quote from the link above:

File setup.py: PY_PROG =

'trek10.py' APP_NAME = 'Trek_Game'

cfg = {

'name':APP_NAME,
'version':'1.0',
'description':'',
'author':'',
'author_email':'',
'url':'',

'py2exe.target':'',
'py2exe.icon':'icon.ico', #64x64
'py2exe.binary':APP_NAME, #leave off the .exe, it will be added

'py2app.target':'',
'py2app.icon':'icon.icns', #128x128

'cx_freeze.cmd':'~/src/cx_Freeze-3.0.3/FreezePython',
'cx_freeze.target':'',
'cx_freeze.binary':APP_NAME,
}

- chick -

+2
source

Icon binding responds in other answers. Creating things is as easy as using png2ico . It creates an ico file with 1 or more png and processes several sizes, etc., for example:

png2ico myicon.ico logo16x16.png logo32x32.png

myicon.ico 16x16 32x32. 8 256x256.

+2

py2exe pyinstaller ( , svn - ) http://pyinstaller.python-hosting.com/

pyinstaller spec Makespec.py EXE. ico;

= True)

console = True, icon = 'mine.ico')

, mine.ico , Makespec.py. . ,

python Makespec.py -i 'mine.ico' /path/to/file.py
+2

py2exe, google search this, exe , .

If you want to create .ico files, I would really suggest you look for an icon constructor or ready-made icons. Of course, you can create a Win 3.x style icon quite easily by creating a 16x16, 32x32 or 64x64 px image in paint and rename it to .ico. But creating modern icons with multiple resolutions for windows is much more difficult.

(I was going to ask what OS you are compiling for when I realized that "exe" sounds very windows and of course ...)

-1
source

All Articles