[ACCEPTED]-How to specify py2app icon?-py2app

Accepted answer
Score: 26

In your setup.py, add iconfile

This is a setup.py script generated by py2applet

    python setup.py py2app

from setuptools import setup

APP = ['main.py']
    'plist': {'CFBundleShortVersionString':'0.1.0',}

    options={'py2app': OPTIONS},


Score: 9

Answering my own question.

To add an icon 7 file simply add the iconfile option when 6 creating setup.py:

py2applet --make-setup foo.py --iconfile images/icon.icns

Note: You must not leave 5 the icon.icns under the same folder as your main 4 script foo.py. It must be placed under a subfolder 3 like images/, otherwise you'd end up with DATA_FILE=['--iconfile'] in your 2 setup.py, which would fail because that's not a 1 data file.

Score: 1

These solutions didn't work for me on python3. The 6 --iconfile switch was throwing errors about 5 not finding the file. In fact the switch 4 is not even needed. This worked for me.

py2applet --make-setup MyApplication.py myicon.icns
python3 setup.py py2app

Just 3 put the icon in the same folder as the source 2 code and this does what you want. Found 1 in py2applet help.

More Related questions