Search code examples
pythonwxpython

How to trigger event every time text ctrl input complete?


I have a text ctrl defined as:

self.item= wx.TextCtrl(self, -1, "",style=wx.TE_LEFT)

The user enter number in there. I want that when he finished (say the focus was changed somewhere else) an event will be triggered.

What event can do that?


Solution

  • Bind this event:

    self.item.Bind(wx.EVT_KILL_FOCUS, self.OnLoseFocus) 
    

    then catch the event with:

    def OnLoseFocus(self,event):
        do actions...
        event.Skip()