How to use py2exe icon_resources in wxPython application?

Posted by Soviut on Stack Overflow See other posts from Stack Overflow or by Soviut
Published on 2010-03-08T05:14:10Z Indexed on 2010/03/08 5:21 UTC
Read the original article Hit count: 684

Filed under:
|
|
|
|

I have a wxPython application I'm bundling into an exe using py2exe. I've defined an icon in the setup.py file using the following:

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

This works, but I'd like to be able to access that icon from my wxPython application and use it as the window icon that appears in the top right. Currently I'm using the following to load the icon from the file system:

icon = wx.Icon('myicon.ico', wx.BITMAP_TYPE_ICO, 16, 16)
self.SetIcon(icon)

Which works, but requires that the icon sit beside the EXE, rather than bundled inside it.

© Stack Overflow or respective owner

Related posts about wxpython

Related posts about Icons