Accelerator table with Escape

My application should exit when I push the escape button.
I try to implement this with an accelerator table.
The following script may show my predicament: it doesn't work.
Where do I not follow the rules ?

···

-----------------------------------------------------------
#!/usr/bin/env python
'''
A sample demonstrating a non-working accelerator table
'''
import wx

class Front(wx.Frame):
    def __init__(self,titel,pos,size):
        wx.Frame.__init__(self, None, -1, titel, pos, size)

        # menu
        menu = wx.Menu()
        hello_item = menu.Append(-1,"Hello", "")
        quit_item = menu.Append(-1,"Quit","")

        menuBar = wx.MenuBar()
        menuBar.Append(menu,"MENU")
        self.SetMenuBar(menuBar)

        self.Bind(wx.EVT_MENU, self.OnHello, hello_item)
        self.Bind(wx.EVT_MENU, self.OnQuit, quit_item)

        # accelerator table
        ac = wx.ACCEL_NORMAL
        esc = wx.WXK_ESCAPE
        qid = quit_item.GetId()
        print("accel_normal: %s" % ac)
        print("escape key code: %s" % esc)
        print("quit_item Id: %s" % qid)
        at = wx.AcceleratorTable( [ (ac, esc, qid )])
        self.SetAcceleratorTable(at)

    def OnHello(self, event=None):
        print("Hello World")

    def OnQuit(self, event=None):
        self.Destroy()

class App(wx.App):
    def OnInit(self):
        self.front = Front("Sample Front",(50,60), (450,340))
        self.front.Show()
        return True

if __name__ == "__main__":
    app = App(False)
    #import wx.lib.inspection
    #wx.lib.inspection.InspectionTool().Show()
    app.MainLoop()
-----------------------------------------------------------
My platform is Linux-debian testing/unstable, kernel 3.2.0-2-686-pae,
with wxpython version 2.8.12.1 (gtk2-unicode).
egbert

--
Egbert Bouwman [GMail]

Does it work after you click on the frame so it is activated? How about if you have a textctrl or something in the frame that has the focus?

···

On 7/22/12 3:53 AM, Egbert Bouwman wrote:

My application should exit when I push the escape button.
I try to implement this with an accelerator table.
The following script may show my predicament: it doesn't work.
Where do I not follow the rules ?

My platform is Linux-debian testing/unstable, kernel 3.2.0-2-686-pae,
with wxpython version 2.8.12.1 (gtk2-unicode).

--
Robin Dunn
Software Craftsman