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

Michael Lange klappnase at web.de
Tue Sep 25 19:29:22 CEST 2012


Hi,

On Tue, 25 Sep 2012 15:18:50 -0000
mkieverpy at tlink.de wrote:

(...)
> 
> What I really get is this: I only get FocusOut when the mouse
> leaves the application window. I do not get FocusOut event
> when I click some other part of the application window
> which nonetheless results in the frame losing focus and no longer
> receiving key events.
> Currently, my guess is that this is broken in tix
> (which unluckily seems not to be under development any more).
> 

Can you post a simple example that shows this problem?
I am not sure if I understood you correctly; I tried the following:

######################################
import tkinter.tix as Tix

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

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

def on_focus_out(event):
    print('focus out')
f.bind('<FocusOut>', on_focus_out)

root.mainloop()
######################################

and here it worked as expected (python 3.1,, debian squeeze with IceWM).
It might very well be a WM specific issue though, did you try different
WMs?

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

	"That unit is a woman."
	"A mass of conflicting impulses."
		-- Spock and Nomad, "The Changeling", stardate 3541.9


More information about the Tkinter-discuss mailing list