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

Bryan Oakley bryan.oakley at gmail.com
Thu Oct 11 19:39:35 CEST 2012


On Thu, Oct 11, 2012 at 12:19 PM, Michael Lange <klappnase at web.de> wrote:
> I am not sure if I understand correctly what you are trying to achieve;
> in one my programs there is a window with a couple of keyboard bindings
> for this and that, there I simply put all the bindings into one method
> like this:
>
>     def apply_default_bindings(self, widget):
>     ...
> and call this once every widget in the window, which
> costs a few extra lines, but otoh saves quite some headaches about which
> widget is focussed.

That's more complicated than it needs to be. I'll give you the same
advice as I just gave someone else: are you aware of "bind_all" and
Tkinter's bindtags? That is a much cleaner way to implement global
bindings IMO. The advantage to "bind_all" is that individual widgets
can override the default bindings if they want (eg: if you want
control-o to mean something totally different only in one widget, you
can).


More information about the Tkinter-discuss mailing list