multiple values for keyword argument

Tobias Blass tobiasblass at gmx.net
Sat Jan 29 08:18:30 EST 2011



On Sat, 29 Jan 2011, Francesco Bochicchio wrote:

>On 29 Gen, 12:10, Tobias Blass <tobiasbl... at gmx.net> wrote:
>> Hi all
>> I'm just learning python and use it to write a GUI (with Tkinter) for a C
>> program I already wrote. When trying to execute the program below I get the
>> following error message.
>>
>> Traceback (most recent call last):
>>   File "./abirechner.py", line 64, in <module>
>>       win =MainWin()
>>   File "./abirechner.py", line 43, in __init__
>>       self.create_edit(row=i);
>> TypeError: create_edit() got multiple values for keyword argument 'row'
>>
>> I don't really understand why create_edit gets multiple values, it gets one
>> Integer after another (as I see it)
>> Thanks for your help
>>
>> abirechner.py:
>>
>> # line 37
>> class MainWin(Frame):
>>         def __init__(self,master=None):
>>                 Frame.__init__(self,master)
>>                 self.grid()
>>                 self.edits=()
>>                 for i in range(10):
>>                         self.create_edit(row=i);
>>         def create_edit(row,self):
>>                 # LineEdit is defined, but I don't consider it important here
>>                 self.edits+=LineEdit()
>>                 self.edits[-1].grid(row=row,column=0)
>> # ...
>> #line 64
>> win = MainWin()
>> win.mainLoop()
>
>Try this:
>
>>         def create_edit(self, row):
>
>Ciao
>---
>FB
>

Ok it works now. So the problem was that python requires 'self' to be the first
parameter?


More information about the Python-list mailing list