Hi,
Was a change made to the accelerator system between 2.8.4.0 and 2.8.9.1? I can't find a mention of it in recent changes, but the following code works on the former, but 'OnFunctionKey' is never invoked on the later. Both systems run Windows XP. The former has Python 2.4.x and the later has 2.5.x, although I have trouble thinking that matters.
TIA,
-Gary
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title)
accel = [( wx.ACCEL_NORMAL, wx.WXK_F1, 101),
( wx.ACCEL_NORMAL, wx.WXK_F2, 102),
( wx.ACCEL_NORMAL, wx.WXK_F3, 103),
( wx.ACCEL_NORMAL, wx.WXK_F4, 104),
( wx.ACCEL_NORMAL, wx.WXK_F5, 105)
]
aTable = wx.AcceleratorTable(accel)
self.SetAcceleratorTable(aTable)
self.Bind(wx.EVT_MENU, self.OnFunctionKey, id=101, id2=105)
def OnFunctionKey(self, evt):
print 'OnFunctionKey', evt.GetId()
class MyApp(wx.App):
def OnInit(self):
self.frame = MyFrame(None, -1, "Accelerator Test")
self.frame.Show(True)
self.SetTopWindow(self.frame)
return True
if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()