Hi Robin,
Robin Dunn wrote:
Werner F. Bruhin wrote:
I am trying to use a custom bitmap for the disabled state of toolbar icons.
self.myTB.AddLabelTool(label = _('Charts'),
bitmap = bmp,
bmpDisabled = bmpDA)Doing the above shows an error dialog "Couldn't add an image to the image list".
Which platform?
Windows XP Pro SP1 with wxPython 2.6.1.0 and Python 2.4.1
Is bmpDA the same size as bmp?
Yes the tools where I really care, e.g. the first one below they are 32x32, I also do "self.myTB.SetToolBitmapSize(wx.Size(32, 32))" when creating the toolbar. On the second one I really would want to use wx.NullBitmap but it refuses to do this.
Ah, probably the " images.getTog2Bitmap() " used on the second tool is not the same size.
Rescaling did the trick, replaced
bmp = images.getTog2Bitmap()
with:
img = images.getTog2Image()
bmp = wx.BitmapFromImage(img.Rescale(32,32))
and at that point I did no longer need to give a dummy bitmap for the disabled state.
It would be nice if the error thrown gives some indication on which tool it has a problem.
I also had no problem as long as I used wx.NullBitmap on all tools for disabled state.
Best regards
Werner