TextCtrl focus events in wxWidgets

Simon Hibbs simon.hibbs at gmail.com
Wed Jul 19 06:15:36 EDT 2006


Steve Holden wrote:

> It should be quite simple: you need to handle EVT_SET_FOCUS and/or
> EVT_KILL_FOCUS events (documented in the wxPython docs) to know when to
> recaclulate the values. Sounds like that should be enough of a hint to you.

I've tried that, but it doesn't work. Here is the test code:

    self.PlantCtrl = wx.TextCtrl(self, -1, "")

    self.Bind(wx.EVT_KILL_FOCUS, self.OnUpdatePlantCtrl,
self.PlantCtrl)

    def OnUpdatePlantCtrl(self, event):
        print "set Plant"

When the control loses focus, I don't get the message in the console.
I'm trapping other events successfuly elsewhere using similar code.

Simon Hibbs
.




More information about the Python-list mailing list