I have been trying to support wxPython 2.5 for my program and have
successfully compiled and installed wxPython 2.5.1.5 and have come upon a
strange problem. I use many png-images that have an alpha channel. I load
the png-image using "img = wxImage(file, wxBITMAP_TYPE_ANY)" and it
reports that it has an alpha channel when I query img.HasAlpha(). The
problem is that when I convert the image using "bmp =
wxBitmapFromImage(img)" it sometimes doesn't get a transparency mask set
at all, where sometimes is when the alpha channel contains values that
aren't completely transparent or completely solid. This problem appears
both in Windows and in Linux (tested using gtk2). It worked correctly in
wxPython 2.4. Am I doing something wrong here? How should I do to get that
transparency mask in 2.5?
/Ragnar
Ragnar Ouchterlony wrote:
I have been trying to support wxPython 2.5 for my program and have
successfully compiled and installed wxPython 2.5.1.5 and have come upon a
strange problem. I use many png-images that have an alpha channel. I load
the png-image using "img = wxImage(file, wxBITMAP_TYPE_ANY)" and it
reports that it has an alpha channel when I query img.HasAlpha(). The
problem is that when I convert the image using "bmp =
wxBitmapFromImage(img)" it sometimes doesn't get a transparency mask set
at all, where sometimes is when the alpha channel contains values that
aren't completely transparent or completely solid. This problem appears
both in Windows and in Linux (tested using gtk2). It worked correctly in
wxPython 2.4. Am I doing something wrong here? How should I do to get that
transparency mask in 2.5?
I just tried this wx.BitmapFromImage(img) on a toolbar and it works fine here with a semi transparent PNG.
This is wxp 2.5.1.5 and WinXP.
As I found out though it doesn't work with PNGs which have been saved using wxBitmap.SaveFile or
which have been embedded in a .py file using img2py.
Regards
Adi
···
--
Adi J. Sieker http://www.sieker.info/
Freelance developer sieker.io – freelance software development