hi can someone help please key bind

MRAB python at mrabarnett.plus.com
Sat Oct 15 15:34:14 EDT 2011


On 15/10/2011 18:30, Gary wrote:
> Hi im trying to use key bind on Tkinter to call this function
>
> def Start():
>     for i in range(60,-1,-1):
>         ent['text'] = i
>       time.sleep(1)
>       root.update()
>     ent['text'] = 'Time Out!'
>     root.update()
>
> i know the function is ok as i have assigned a button and i calls the 
> function as i expect
> but
> root.bind('<a>',Start)
> gives the following error
>
> Exception in Tkinter callback
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
>     return self.func(*args)
> TypeError: Start() takes no arguments (1 given)
>
The function will be called with an 'event' parameter, but you've 
defined it function to accept no
parameters, hence the error message.




More information about the Python-list mailing list