![]() |
Set application Icon wxPython
Anyone knows how to set the application icon for a wxPython app? I have some leads about the wx.Frame.SetIcon() function, but how do I load the icon from a .ico or .bmp file into my program?
|
Re: Set application Icon wxPython
There's a wxBitmap function. Check the alphabetical class reference in the docs. I'll look for the exact code when I get home.
|
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):Edit: And here's the Alphabetical Class Reference. Perhaps the most useful thing out there for wxWidgets and wxPython. |
Re: Set application Icon wxPython
Works great. I was going about it the wrong way trying to self.SetIcon() on on the frame class since I couldn't find decent references for this specific issue under wxPython documentations. I really miss the F1 in C# & MSDN when working with python. Thanks for the help.
|
Re: Set application Icon wxPython
I am pretty sure those last two lines can be written like this as well (notice the self.SetIcon()):
:
|
Re: Set application Icon wxPython
I tried that and it seems to work... I was calling self.SetIcon(self, favicon) and it complained about the arguments but my real issue was reading the icon from a file.
I really don't understand the 'self' keyword. I try to think of it as 'this' in C++, but why does every function of a class has to have it as first argument in the definition, but then when you call it you have to omit the first argument? It's just a confusing way to do things! Back to the icon issue, this is unrelated but if anyone out there is looking for a way to set the icon of an exe file when using py2exe, here's how your setup.py should look like: :
|
| All times are GMT -5. The time now is 12:53 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC