Interesting. We hadn't this problem with 2.4.2.4 too.
Is there any way to make it standard for all objects that handle images or
we'd have to set up one by one? Due to the repetition of icons in this
particular screen, it would even be interesting to do that only once and
reuse the image, but there are other screens where we have different images
and having to modify one by one would be, at least, slow and
counterproductive...
What I have now is:
self.btnExit = wxBitmapButton(self.panel_1, btnExit,
(wxBitmap(os.path.sep.join([images, 'exit.png']))))
self.txtExit = wxStaticText(self.panel_1, -1, "Exit")
I tried changing that to
self.btnExit = wxBitmapButton(self.panel_1, btnExit,
(wxBitmap(os.path.sep.join([images, 'exit.png'])).SetMask(True)))
But it didn't work (I thought it wouldn't because the return type would be
different, but I was just being optimistic... :-)). I also tried setting up
the wxBITMAP_TYPE_PNG, but it did no difference at all.
I also tried this:
bmpExit = wxImage(os.path.sep.join([images, 'exit.png']),
wxBITMAP_TYPE_PNG)
bmpExit.SetMask(True)
bmpExit = bmpExit.ConvertToBitmap()
but the problem persisted and I got the white background.
The same happens with wxBitmapFromImage()...
I think this is something related to the conversion to Bitmap.
Be seeing you,
···
On Ter 25 Mai 2004 20:08, Paul McNett wrote:
Jorge Godoy writes:
Does anybody here have problem with transparent PNGs being
used in buttons? wxPython 2.5.1.5, Python 2.3.3, w/o Unicode.
I had problems until doing image.SetMask(True), as in:
r = wx.Image(fileName, wx.BITMAP_TYPE_PNG)
r.SetMask(True)
I didn't need to do that in 2.4, but now I do in 2.5. I haven't
tried anything on WinXP yet though, just Linux/Mac/WinNT4.
But I still have problems with some PNG's on Mac - some don't
appear at all while most do, so I've just ignored it for now,
hoping it'll magically fix itself in the next release. <g>
--
Godoy. <godoy@ieee.org>