View Single Post
Old Mar 8th, 2008, 1:57 PM   #3
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,798
Rep Power: 5 Sane will become famous soon enough
Re: Set application Icon wxPython

I believe there are multiple ways to do it, including the wxBitmap way. But the easiest way is with wxIcon.

Here, wx.BITMAP_TYPE_ICO specifies that the file is .ico. I've found that no other format will handle transparency very well (including PNG) for application icons.

class myApp(wx.Frame):

    def __init__(self, parent):

        wx.Frame.__init__(self, None,
            pos=wx.DefaultPosition, size=wx.Size(548, 438),
            style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN, 
            title="My Application")

        favicon = wx.Icon('favicon.ico', wx.BITMAP_TYPE_ICO, 16, 16)
        wx.Frame.SetIcon(self, favicon)

Edit: And here's the Alphabetical Class Reference. Perhaps the most useful thing out there for wxWidgets and wxPython.
Sane is offline   Reply With Quote