Hi all,
I'm a lazy person, and prone to typing errors, so I made me a function on my class of wx.Frame:
def addAccelerator(self, mods, key, action):
newId = wx.NewId()
self.Bind(wx.EVT_MENU, action, id = newId)
self._acceleratorTable.append((mods, key, newId))
Then, just before I show the frame, I do:
self.SetAcceleratorTable(wx.AcceleratorTable(self._acceleratorTable))
All that works... What doesn't seem to work is this:
for key in range(44, 94):
for modifiers in [wx.ACCEL_NORMAL, wx.ACCEL_SHIFT, wx.ACCEL_CTRL|wx.ACCEL_SHIFT]:
self.addAccelerator(modifiers, key, lambda event: self.onKey(modifiers, key))
What I'm trying to do is add accelerators for every key on the keyboard, then add in shift with those keys, and control shift. But when I run the program, and press a key, no matter which key I press, I get keycode 93, with modifiers 6 (wx.ACCEL_CTRL|wx.ACCEL_SHIFT).
So it seems as though the table is only acknowledging the last key entered, even though printing out the table gives millions of entries.
Any thoughts on why? Not sure if this is a wx thing, or a me not know enough python thing, but I thought I'd ask here.
Cheers,