[Tutor] event binding

wheelege wheelege@tsn.cc
Thu, 18 Jan 2001 16:14:36 +1100


  I'm a newbie so this may be wrong, I'll make comments.

> There must be something I'm missing about event binding.
> 
> What I would really like is to know whenever an Entry widget loses focus

Hmmm stop there...

you can always use the <FocusOut> binding.

like say instead of 

e_wid.bind('<Button-1>',got_event)

you could have

e_wid.bind('<FocusOut>',got_event)

> but I'll settle for trapping the <Tab> or <Return>.
> 
> I can bind <Button-1> successfully but the same statement using <Tab> or
> <Return> does nothing. 
> 
> e_wid = Entry(win)
> e_wid.bind('<Tab>',got_event)           #doesn't work

try...

e_wid.bind('<Key-Tab>',got_event)

> e_wid.bind('<Button-1>',got_event)      #this works
> 
> def got_event(ev):
> print "got one!"
> 

  Well if it doesn't work then hmmm well, what do you expect I'm a newbie!

  Glen.