import wx

def QuitWithCmdQ(event):
    print 'quitting!'
    event.Skip()

def TestFunction(event):
    print 'Received', type(event)
    event.Skip()

app = wx.App(False)
frame = wx.Frame(None, wx.ID_ANY, "Hello World")

cmd_q = wx.NewId()
cmd_w = wx.NewId()
frame.Bind(wx.EVT_MENU, QuitWithCmdQ, id=cmd_q)
frame.Bind(wx.EVT_MENU, TestFunction, id=cmd_w)
accelerators = wx.AcceleratorTable([
    (wx.ACCEL_CMD, ord('Q'), cmd_q),
    (wx.ACCEL_NORMAL, ord('W'), cmd_w),
])
frame.SetAcceleratorTable(accelerators)
frame.Show(True)

app.MainLoop()