Problem with grid component

I have this pieces of code

def OnAddRecord(self,event):

   self.table.AppendRows()

   msg = wx.grid.GridTableMessage(self.elenco,wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED,1)

   self.elenco.GetView().ProcessTableMessage(msg)

working perfect in unix enviroment, not working in windows enviroment the error is this:

File "C:\Python25\lib\site-package\wx-2.8-msw-ansi\wx\grig.py , line 1221 , in AppendRows return _grid.Grid_AppendRows(*args, **kwargs)

wx._core…PyAssertionError: C++ assercion “wxAssertFailure” failed at …\src\generic\grid.cpp(3287) in wxGridTableBase::AppendRows(): Called grid table class functin AppendRows but your derived table class does not override this function

there is a good example to work around this problem making the code working in unix and windows the same. The only I have to do is to append a empty row to a grid whith a botton making this operation when pusched.

Thenk for the hlep Angelo

Angelo Ballabio wrote:

I have this pieces of code

def OnAddRecord(self,event):
       self.table.AppendRows()
       msg = wx.grid.GridTableMessage(self.elenco,wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED,1)

       self.elenco.GetView().ProcessTableMessage(msg)

working perfect in unix enviroment, not working in windows enviroment the error is this:

File "C:\Python25\lib\site-package\wx-2.8-msw-ansi\wx\grig.py , line 1221 , in AppendRows return _grid.Grid_AppendRows(*args, **kwargs)
wx._core..PyAssertionError: C++ assercion "wxAssertFailure" failed at ..\..\src\generic\grid.cpp(3287) in wxGridTableBase::AppendRows(): Called grid table class functin AppendRows but your derived table class does not override this function

there is a good example to work around this problem making the code working in unix and windows the same. The only I have to do is to append a empty row to a grid whith a botton making this operation when pusched.

The reason it appears to work on unix is likely that wxWidgets/wxPython was built without the runtime assertions turned on. In actuality the code is just as incorrect there as it is on Windows, but whoever built your unix packages doesn't care if you know that or not. (If you're on Ubuntu then try using the packages for the debug version of Python and wxPython, then at least you'll get the runtime assertions while in development mode.)

Anyway, if you are not overriding your table's ApepndRows then there is no reason to call it. Just remove that line.

···

--
Robin Dunn
Software Craftsman