EVT_TEXT_ENTER can not be caught in a subclass of wx.Dialog

Sean sean0601 at pchome.com.tw
Tue Oct 12 13:32:19 CEST 2004


Hi,
  I found if a wx.TextCtrl is used in a subclass of wx.Dialog, the
event wx.EVT_TEXT_ENTER can not be caught, that is, key code of RETURN
can not be indentified.

class MyDialog(wx.Dialog):
    def __init__(self,parent,pos,size,style):
        ...
        self.t1 = wx.TextCtrl(self, -1, "", size=(125, -1))
        self.t1.Bind(wx.EVT_CHAR, self.OnChar,self.t1)
        ...

    def OnChar(self, event):
        if (event.GetKeyCode() == 13):
            print "%d"%event.GetKeyCode()
        else:
            print "%d"%event.GetKeyCode()
        event.Skip()


How could I effectively bind a handler to EVT_TEXT_ENTER in it?


Thanks,
Sean



More information about the Python-list mailing list