george young wrote:

>[pygtk-0.6.6, gtk+-1.2.7, python 2.1, i86 linux 2.2.16]
>
>I have some text and entry widgets, and when the user changes the
>value in one of them and moves on to another widget in the GUI,
>I need to grab the changes and put them in the database. 
>
>I've tried:
>    self.comment_text.connect('leave_notify_event', self.leave_event, 
>self.comment_text)
>    def leave_event(self, a, ev, c):
>        for s in dir(ev):
>            print s, eval('ev.%s' % s)
>
>but it's not clear how to decode the event object.  
>The 'type' field is certainly == gtk.GDK.LEAVE_NOTIFY == 11, 
>but I get this event on entering AND twice on leaving the widget!
>
>How can I distinguish these?  Sometimes the 'detail' field varies, but
>it doesn't seem reliable.  
>
>Or is there some altogether different approach
>to this problem?
>
For this sort of thing, you are probably more interested in keyboard 
focus, rather than mouse focus.  enter/leave notify events get triggered 
as the mouse pointer crosses window boundaries.

If you want to know when the keyboard focus enters or leaves a widget 
(which is a different thing), use focus_in_event and focus_out_event.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/




_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to