[Tkinter-discuss] FocusOut not working as expected - tix broken?

mkieverpy at tlink.de mkieverpy at tlink.de
Mon Oct 8 13:09:30 CEST 2012


Hello Michael,

I found a workaround:

------------------------------------------------
import tkinter

root = tkinter.Tk()
f = tkinter.Frame(root)
f.pack(fill='both', expand=1)
tkinter.Button(f, text='foo').pack()

f2 = tkinter.Frame(root)
f2.pack(fill='both')
tkinter.Button(f2, text='bar').pack()

f3 = tkinter.Frame(root)
f3.pack(fill='both')

def on_key(event):
    print('key')
def on_focus_out(event):
    print('focus out')
    f3.focus_set()
f3.focus_set()
f3.bind('<Key>', on_key)
f3.bind('<FocusOut>', on_focus_out)

root.mainloop()
------------------------------------------------

The other program does not look wrong though.
I think I'll ask at tcl/tk if they think it's a bug.

Regards,
Matthias Kievernagel




More information about the Tkinter-discuss mailing list