Robin Dunn apparently wrote:
Andre Roberge wrote:
I was trying to use GenBitmapButton.s with AcceleratorTable.s and
could not get it to work.
If I use "ordinary" Button.s, the AcceleratorTable.s work as expected.
After looking at the demo, I found out that BitmapButton.s also
work properly.
I can not find any explanation for this behaviour; I "assume" it is a
bug. I'm just reporting it here in an attempt to be useful. I'm
happy to use wx.BitmapButton instead of GenBitmapButtonI'd like to investigate this further. Please create a small but
complete sample app that shows the problem. Also, what platform and
version are you using.
Robin Dunn
wxPython2.6.1.0, unicode version.
Windows XP
Python 2.4.2
Sorry, I only had time to do a quick cut/paste and edit in the wxPython demo.
Besides, this way ensures that a proper bitmap image is loaded
In the bitmap button demo (under core windows/controls), add near the top:
import wx.lib.buttons as buttons
I found that I couldn't assign, in the demo, b= wx.lib.buttons.GenBitmapButton
without getting an error... I'm puzzled by that.
Then, comment out lines 32 and 33 (as shown in the first two lines
included below) and add the following code:
···
============
#b = wx.BitmapButton(self, 30, bmp, (20, 20),
# (bmp.GetWidth()+10, bmp.GetHeight()+10))
# new code for testing purpose
size = (bmp.GetWidth()+10, bmp.GetHeight()+10)
b = buttons.GenBitmapButton(self, 30, bmp, (20, 20), size=size)
#b = wx.Button(self, 30, "label", (20, 20), size=size)
aTable = wx.AcceleratorTable([(wx.ACCEL_NORMAL, wx.WXK_F2, 30)])
self.SetAcceleratorTable(aTable)
# end of new code
This is the non-working version. The other two ways to create a
button above (including the original) are invoked properly when
pressing F2.
Hope this helps
André
P.S. I don't subscribe to the wxPython-users list; it is only by
chance/curiosity that I read your response today. I'll try to monitor
in the next few days in case more info is needed.