[Tutor] binding problem

Chris Hare chare at labr.net
Thu Nov 3 14:01:41 CET 2011


Thanks for the advice.  When I do that, I get this error

Exception in Tkinter callback
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__
    return self.func(*args)
TypeError: focus_set() takes exactly 1 argument (2 given)

In situations like this where the function isn't one you wrote, how to you debug these?

Chris Hare
chare at labr.net
http://www.labr.net

On Nov 3, 2011, at 3:23 AM, Alan Gauld wrote:

> On 03/11/11 04:46, Chris Hare wrote:
>> 
>> I have a Listbox defined
>> 
>> self.list = Listbox(self.frame)
>> 
>> What I want to do is when the user either single clicks, double clicks, presses tab or return, move the focus to the specified field
>> 
>>                 self.list.bind("<Button-1>", self.login_userid.focus_set())
> 
> Don't call the function, just pass its name:
> 
> self.list.bind("<Button-1>", self.login_userid.focus_set)
> 
> HTH,
> 
> -- 
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list