Unbind default button behavior in wxPython
Question: I am writing an interface where I'd like to have a user click a button, then
capture his next keystroke.

I can currently capture all the keys on the keyboard, except for those like
tab or the arrow keys which cause the button to lose focus when pressed. I
know that I need to unbind the window from keypress events during the capture
interval.

I've already tried unbinding from the frame, the notebook tab widget, and the
panel that's inside it, and it has not worked.

Where in the hierarchy do I need to unbind key presses to avoid having them
behave the way they normally do? Thanks


Answer: 
    import wx 
    
    a = wx.App(redirect=False)
    class XFrame(wx.Frame):
        def __init__(self,*args):
            wx.Frame.__init__(self,*args)
            b = wx.Button(self,-1,"Click")
            b.Bind(wx.EVT_BUTTON,self.OnButton)
        def OnButton(self,evt):
            self.SetFocus()
            self.Bind(wx.EVT_CHAR,self.OnChar)
        def OnChar(self,evt):
            print evt.KeyCode
            self.Unbind(wx.EVT_CHAR)
    
    f = XFrame(None,-1,"A Frame")
    
    f.Show()
    a.MainLoop()
    

I think anyway

