Disabled image in toolbar turns partially black

Hello wxPython users,

I’m working with a wxToolbar ( CreateToolBar(wx.TB_HORIZONTAL|wx.TB_FLAT) ) but one way or another the images I use in this toolbar turn partially black (see messedup.png and enabled.png) when I disable them. I’m adding bitmaps with the follow code:

toolBar.AddLabelTool(ID, “”, bmp)

Where bmp is:

icon = wx.Icon(filename, wx.BITMAP_TYPE_ICO, width, height)
bmp = wx.EmptyBitmap(32,32)
bmp.CopyFromIcon(self.icon)

Also, I disable the bitmap by using the following:

toolBar.EnableTool(ID, False)

The weird thing is they only do this when I add them to the main program (which is a huge program). But when I create a proof of concept (pocenabled.png and pocdisabled.png) the image works fine. Please note that in the proof of concept I’m also using wx.Bitmap and wx.BitmapFromIcon but the first icon you see is a wx.EmptyBitmap which is also used in the main program. So now I’m wondering, is there some sort of settings which makes the main application behave different from the proof of concept? It’s kind of difficult to disassemble the main program so I really hope you guys got an idea about how to solve this or atleast guide me to a direction where and what to search for. Because I’m kinda clueless at the moment.

Yours,

Brian

PS. Images are attachments

messedup.png

enabled.png

pocenabled.png

pocdisabled.png

Brian S wrote:

Hello wxPython users,

I'm working with a wxToolbar ( CreateToolBar(wx.TB_HORIZONTAL|wx.TB_FLAT) ) but one way or another the images I use in this toolbar turn partially black (see messedup.png and enabled.png) when I disable them.

This problem (or a similar one) was discussed a few weeks ago. http://lists.wxwidgets.org/pipermail/wxpython-users/2008-October/081343.html

I'm adding bitmaps with the follow code:

toolBar.AddLabelTool(ID, "", bmp)

Where bmp is:

icon = wx.Icon(filename, wx.BITMAP_TYPE_ICO, width, height)
bmp = wx.EmptyBitmap(32,32)
bmp.CopyFromIcon(self.icon)

Also, I disable the bitmap by using the following:

toolBar.EnableTool(ID, False)

The weird thing is they only do this when I add them to the main program (which is a huge program). But when I create a proof of concept (pocenabled.png and pocdisabled.png) the image works fine. Please note that in the proof of concept I'm also using wx.Bitmap and wx.BitmapFromIcon but the first icon you see is a wx.EmptyBitmap which is also used in the main program. So now I'm wondering, is there some sort of settings which makes the main application behave different from the proof of concept? It's kind of difficult to disassemble the main program so I really hope you guys got an idea about how to solve this or atleast guide me to a direction where and what to search for. Because

Does the main program happen to set the "msw.remap" system option? I can't think of anything else that would cause a difference like this, but I suggest that you try bypassing portions of the application (in the initialization parts at least) to help you narrow down what might be the cause.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!