Re: Bug in Tkinter??

Guido.van.Rossum@cwi.nl
Mon, 04 Jul 1994 12:34:56 +0200

> I think there's a bug in Tkinter, or perhaps I'm using the bind_all()
> method incorrectly. Here's a tiny code snippet that demonstrates the
> bug. What I'd expect (and what I'm trying to build) is for the words
> "this is a button" to be printed whenever I use Shift-Button-3,
> regardless of the widget. For this, I create a button and use
> bind_all() to tie the shift-button-3 pattern to a callback. Problem
> is, the function never gets called.

Yes, this is a bug in Tkinyter.py. In bind_all, there's an occurrence
of `name` which shouldn't have backquotes:

*** 1.11 1994/06/27 23:15:31
--- Tkinter.py 1994/07/04 10:33:27
***************
*** 288,294 ****
if add: add = '+'
name = self._register(func, self._substitute)
self.tk.call('bind', 'all' , sequence,
! (add + `name`,) + self._subst_format)
def bind_class(self, className, sequence, func, add=''):
if add: add = '+'
name = self._register(func, self._substitute)
--- 288,294 ----
if add: add = '+'
name = self._register(func, self._substitute)
self.tk.call('bind', 'all' , sequence,
! (add + name,) + self._subst_format)
def bind_class(self, className, sequence, func, add=''):
if add: add = '+'
name = self._register(func, self._substitute)

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