I tried this code…
This is not working. unable to see any icon.
I am not getting any error in console, what can be the problem ?
PreferencesMenuItem = menuEdit.Append(-1, ‘Preferences’, ‘View Prefrences. Still not configured.’)
PreferencesMenuItem.SetBitmap(wx.Bitmap(‘icons/preferences-desktop.png’))
ArtProvider icons are system-independent. To use an operating system’s icons you must first extract them. How to do this is very specific the the particular operating system you are using. The easiest way to accomplish this is to use a separate utility written for your system to extract these operating system icons to PNG files.
PNG files, as well as all other common image/graphics files can be read into a wx.Bitmap. Bitmaps can not be displayed directly, so use a control such as a wx.StaticBitmap, wx.BitmapButton or wx.Icon. You can also use a DC tool to Blit the bitmap directly to a Panel. Once the Bitmap has been put into a control, that control will be visible and can be positioned like all other controls.
I can only tell you how to extract icons from MS Windows DLL’s and executable files using free tools, but I imagine that GNU systems have many equivalent utilities to do this.
I can set icons using this but I want to use system icon so that my application loox similar to other apps…
I am using GNU/Linux
On GTK you can use “stock items” for menu and buttons (i.e., the menu label, accelerators, help strings and bitmaps are provided by the platform). See here:
Does the specified file exist? Since you don't give a full pathname then it will look for it relative to the process' current working directory. (check it with print os.getcwd())
···
On 8/28/11 9:06 AM, Narendra Sisodiya wrote:
I tried this code..
This is not working. unable to see any icon.
I am not getting any error in console, what can be the problem ?
PreferencesMenuItem = menuEdit.Append(-1, 'Preferences', 'View
Prefrences. Still not configured.')
PreferencesMenuItem.SetBitmap(wx.Bitmap('icons/preferences-desktop.png'))