I'm having trouble displaying an icon properly. I've created a 32x32 image using
MS Paint and have saved it as a bmp file and converted it to a Windows icon
file. The icon was then placed in the toolbar by the following code;
This worked like a dream under wxPython 2.3.2 but the image doesn't appear
with 2.3.3.1. This is probably due to the slight difference in the
CopyFromBitmap method which is reflected in the documentation as;
"Under MS Windows the bitmap must have mask colour set."
Try as I might, I can't find any references to mask colour (or even color) on
the web and even my graphics guru doesn't know what it refers to.
Has anyone else run into this problem and successfully resolved it?
If I revert to .bmp format the icon appears but doesn't have a transparent
background. If I use the .ico nothing appears at all. I have tried to
manipulate my image (in both MS Paint and the Gimp) but to no avail.
"Under MS Windows the bitmap must have mask colour set."
Try as I might, I can't find any references to mask colour (or even color) on the web and even my graphics guru doesn't know what it refers to.
Has anyone else run into this problem and successfully resolved it?
...
I'm not sure I can help you on this one, but I do know that in the small amount of BMP icon editing I've done, the RGB colour magenta (255, 0, 255) seems to be recognized as "transparent" - if you have Visual Studio, you might also try the icon editor in that package, they have transparency available somehow as well, in my recollection.
I'm having trouble displaying an icon properly. I've created a 32x32 image using
MS Paint and have saved it as a bmp file and converted it to a Windows icon file. The icon was then placed in the toolbar by the following code;
Also, if it's going on a toolbar then you can avoid the conversion to a wxIcon and just use a wxBitmap, and any image format that can have a mask (PNG, XPM, GIF) should work fine.
bmp = wxBitmap(filename, wxBITMAP_TYPE_PNG)
wxWindows will automatically fall back to wxIMage when it needs to.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!