Robin Dunn wrote:
The native toolbar control used on Windows does not use the 2nd bitmap,
it manages drawing the toggled state itself.
I found a work around. In my __init__ method I save the bitmaps, the tool, and the toolbar like this:
# work around a bug that prevents the toggle bitmaps from working properly
self.tb = tb
self.CopyTool = tb.FindById(self.CopyId)
self.CopyToolBitmaps = [ wx.Bitmap('icons/NoCopy.bmp', wx.BITMAP_TYPE_BMP),
wx.Bitmap('icons/Copy.bmp', wx.BITMAP_TYPE_BMP) ]
# end of workaround
Then in my handler for EVT_TOOL for the tool I call this method to update the bitmap.
def UpdateToggleCopy(self):
# work around a bug that prevents toggle bitmaps from being seen
self.CopyTool.SetBitmap1(self.CopyToolBitmaps[self.CopyState])
self.tb.Realize()
# end of workaround
gb