Hi,
On Wed, 10 Oct 2012 11:37:35 +0200, Michael Lange wrote:
(...)
The problem is when I use the 'Tab' key to move
the focus. The first 'Tab' moves the focus
to the 'foo' button. 'f' no longer gets key events
but does not get the focus out event either.
The next 'Tab' moves the focus to the 'bar' button,
'f' gets the focus out event and key events arrive again
after I do 'focus_set'.
So it looks like tk standard behaviour. Can I get what I want?
With your example from the previous post the focus will never reach
the
"bar" button, maybe it was a typo in on_focus_out() and should be
f2.focus.set() ?
Anyway, I am not sure what exactly you want to achieve (maybe I
missed
something from your previous posts?), is there a particular reason
why not
to do nothing about focus handling and just leave it to the WM?
Sorry, to have been unclear here.
My main interest is capturing all keyboard input
with these lines:
------------------------------
def on_key(event):
print('key')
f.bind('<Key>', on_key)
------------------------------
I want to use this to implement keyboard control for some features.
In the case where 'f' has children which can get focus
I may loose keyboard input because 'f' won't get notified
about FocusOut (lines 2-4 in my above description).
In the workaround I use a frame without children.
In this case I always get the FocusOut event and
can reclaim focus with 'f.focus_set()'.
Regards,
Matthias Kievernagel
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss