Strange behavior of accelerators?

The small program below demonstrates the strange behavior of the "p" key when I attach a menu event to Page-Up. When I run the program any other key produces EVT_CHAR but the letter p produces EVT_MENU. This is Python 2.3.4, wxPython 2.5.2.8, Windows XP-SP2.

Am I doing this wrong? Or is this a bug?
Thanks
gb

'''Is this a bug?'''

import wx

class myApp(wx.App):
  def OnInit(self):
    self.frame = wx.Frame(None, -1, 'bug?')
    self.frame.Bind(wx.EVT_CHAR, self.OnChar)
    self.frame.Bind(wx.EVT_MENU, self.OnMenu)

    al = [
          #(wx.ACCEL_NORMAL, wx.WXK_PAGEDOWN, wx.NewId()),
          (wx.ACCEL_NORMAL, wx.WXK_PAGEUP, wx.NewId()),
         ]

    self.frame.SetAcceleratorTable(wx.AcceleratorTable(al))
    self.frame.Show(True)
    return True

  def OnChar(self, event):
    print 'char'

  def OnMenu(self, event):
    print 'menu'

app = myApp(0)
app.MainLoop()

Gary Bishop wrote:

The small program below demonstrates the strange behavior of the "p" key when I attach a menu event to Page-Up. When I run the program any other key produces EVT_CHAR but the letter p produces EVT_MENU. This is Python 2.3.4, wxPython 2.5.2.8, Windows XP-SP2.

Am I doing this wrong? Or is this a bug?

Probably a little of both. Try using WXK_NEXT/PRIOR instead of WXK_PAGEUP/PAGEDOWN. I'm not sure why there is a distinction between them, but in wxMSW the PAGEUP/PAGEDOWN keys are not translated to the MSW keysyms and the NEXT/PRIOR ones are.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!