Generating an event in Tkinter

Fredrik Lundh fredrik at pythonware.com
Wed Sep 1 03:56:42 EDT 1999


nharlow at my-deja.com wrote:
> I get the following error:
> Traceback (innermost last):
>   File "c:\program files\python\lib\lib-tk\Tkinter.py", line 752, in
> __call__
>     return apply(self.func, args)
>   File "C:\nick\GUI\spidergui.py", line 145, in <lambda>
>     widget.bind("<<foo>>",lambda x=sleep, y=1:x(y))
> AttributeError: no __call__ method defined

the lambda is called with one argument (the event
descriptor), which is then called instead of the sleep
function.  changing the lambda to:

    lambda e, x=sleep, y=1:x(y)

should help.

</F>





More information about the Python-list mailing list