Re: Adding bindings in Tk [QUESTION]

Guido.van.Rossum@cwi.nl
Mon, 27 Feb 1995 11:08:32 +0100

> Something is not behaving as it ought, and I'm hoping it's not me...
[...]

> Now if I change the binding to 'Any-Enter' (or just 'Enter'), which
> I would say is the binding used by the Button classes to trap that
> event so the button can be highlighted, the "hello friend" works
> fine, but the button is no longer highlighted, and indeed doesn't
> work properly any more.
>
> If I wasn't doing the "+" in the bind, then this would be OK, but I
> thought (hoped) that this would add my event to the Button's own, but
> doesn't seem to.

Someone correc tme if I'm wrong, but I seem to recall that there's a
bug in the design and/or implementation of Tk's event handling
(nothing to do with Python) that prevents this kind of thing from
working properly. I think what's recommended is to figure out what
the default binding is from the library source and explicitly repeat
that in your code.

I also believe that all of this has been fixed in Tk 4.0, where the
event binding mechanism has been considerably reworked.

--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>