开发者

How to use py2exe icon_resources in wxPython application?

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.


I do this inside the Frame subclass

if os.path.exists("myWxApplication.exe"):
     self.SetIcon(wx.Icon("myWxApplication.exe",wx.BITMAP_TYPE_ICO))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜