[Tutor] binding problem

Dave Angel d at davea.name
Thu Nov 3 14:26:52 CET 2011


(You mistakenly top-posted, so now in order to keep this next message in 
order, I have to delete the out of order history)

On 11/03/2011 09:01 AM, Chris Hare wrote:
> 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?
>
Lots of clues in that traceback.  We can deduce that you're probably on 
a non-Windows machine, and that you're using CPython 2.7, and Tkinter.  
Those all would have been good information to include in your initial 
posting.

The other thing it tells you is that your function object focus_set() 
takes one too few arguments.  So, the question is how do you determine 
the types of each of those arguments?

First, write a non-class simple function, that takes two arguments, and 
prints the type() and repr() for each.   Use that function object in the 
self.list.bind function call, and see what it prints when it runs.

Then, once you know the types, you have a clue as to what the real 
function should look like.

We don't know what your self and login_user classes look like, so I was 
trying to eliminate them as contenders for the confusion.

The other thing would be to read the tkinter docs, or find example 
code.  But since I've never used tkinter, I can't give you advice along 
those lines.



-- 

DaveA



More information about the Tutor mailing list