[Tutor] what is wrong with this?

Kent Johnson kent37 at tds.net
Sun Feb 13 14:12:11 CET 2005


Liam Clarke wrote:
> Yup, that's what I was after, the full error message.
> 
>  >self.grid1.CreateGrid(100,6)
> 
>>val = gridc.wxGrid_CreateGrid(self, *_args, **_kwargs)
> 
> try this 
> 
> self.grid1.CreateGrid(self, 100, 6)
> 
> I'm pretty sure you have to explicitly pass self.

No, that's not it. There is an asymmetry between the way a method is declared and the way it is 
invoked. In the declaration, you list 'self' as an explicit parameter, e.g.
   def CreateGrid(self, *_args, **_kwargs)
but at the point of call the 'self' argument is implicit, it is the object on which the method is 
invoked. So the call
   self.grid1.CreateGrid(100, 6)
will call CreateGrid with the three arguments (self.grid1, 100, 6)

I don't know what the actual problem is but I'm pretty sure this isn't the solution.

jrlen, the error trace you sent looks incomplete, it doesn't show any of your code. Is there more of it?

Kent

> 
> Let me know how ya go.
> 
> Regards, 
> 
> Liam Clarke
> 
> 
> On Sun, 13 Feb 2005 12:00:56 +0800, jrlen balane <nbbalane at gmail.com> wrote:
> 
>>how would i find the stack trace? by the way, this is what the log says:
>>
>>11:53:16:     TypeError: wxGrid_CreateGrid() takes at least 3
>>arguments (2 given)Traceback(most recent call last):
>>11:53:16:     TypeError: wxGrid_CreateGrid() takes at least 3
>>arguments (2 given)  File
>>"C:\PYTHON23\Lib\site-packages\wxPython\tools\boa\Models\wxPythonControllers.py",
>>line 80, in OnDesigner
>>11:53:16:     self.showDesigner()
>>11:53:16:       File
>>"C:\PYTHON23\Lib\site-packages\wxPython\tools\boa\Models\wxPythonControllers.py",
>>line 145, in showDesigner
>>11:53:16:     designer.refreshCtrl()
>>11:53:16:       File
>>"C:\PYTHON23\Lib\site-packages\wxPython\tools\boa\Views\Designer.py",line
>>379, in refreshCtrl
>>11:53:16:     self.initObjectsAndCompanions(objCol.creators[1:],
>>objCol, deps, depLnks)
>>11:53:16:       File
>>"C:\PYTHON23\Lib\site-packages\wxPython\tools\boa\Views\InspectableViews.py",
>>line 140, in initObjectsAndCompanions
>>11:53:16:     dependents, depLinks)
>>11:53:16:       File
>>"C:\PYTHON23\Lib\site-packages\wxPython\tools\boa\Views\InspectableViews.py",
>>line 216, in initObjProps
>>11:53:16:     getattr(ctrl, prop.prop_setter)(value)
>>11:53:16:       File "C:\PYTHON23\lib\site-packages\wxPython\grid.py",
>>line 973, in CreateGrid
>>11:53:16:     val = gridc.wxGrid_CreateGrid(self, *_args, **_kwargs)
>>11:53:16:     TypeError: wxGrid_CreateGrid() takes at least 3
>>arguments (2 given)
>>
> 
> 
> 



More information about the Tutor mailing list