By default, we see the below taskbar icon when running a sample application (built with py2exe):
As shown on the py2exe site, we can add the following line:
"icon_resources": [(1, "myicon.ico")]
to our build_exe.py script. The code is now:
from distutils.core import setup
import py2exe
from cefpython3 import cefpython
import wx
import time
import re
import uuid
import platform
import inspect
import struct
import urllib
setup(
windows=[{
'script': 'wxpython.py',
"icon_resources": [(1, "myicon.ico")]
}]
)
The icon file I used was created using IcoFX (not free, but very handy) as detailed here. The result is:
To set the icon in the upper-left portion of the application window, you can add the following code (documented here) to the code file (wxPython.py, in our example):
_icon = wx.Icon('app.ico', wx.BITMAP_TYPE_ICO)
self.SetIcon(_icon)
Leave a comment