completely lost in adding row to a grid ...

Sounds like you need to tell the grid you added a row. Checkout
ProcessTableMessage, I use something like the following:
self.ProcessTableMessage(wx.grid.GridTableMessage(self.table,
wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED, 1))

···

On Thu, Jul 24, 2008 at 11:58 AM, Stef Mientki <s.mientki@ru.nl> wrote:

hello,

I'm not able to add dynamically a row to a grid.

I've a grid derived from
wx.grid.Grid

this is controlled by a table, derived from
table = wx.grid.PyGridTableBase

For what I understand of it,
I've to add a "AppendRows" to the derived table,
then when I call the Grid.AppendRows,
the Grid will call the tables AppendRows

Table:
def AppendRows ( self, numRows = 1, updateLabels = True ) :
  self.data.append ( 8*['']) # for simplicity: I know there are 8 columns
  return True

So here is my call to Grid.AppendRows

      self.Grid.AppendRows(1)
      self.Grid.ForceRefresh()
      print 'A',self.Grid.table.GetNumberRows (),self.Grid.GetNumberRows ()

And indeed, the tables method is called,
because self.Grid.table.GetNumberRows () increases,
but the Grid doesn't increase it's number of rows : self.Grid.GetNumberRows
()

A 7 6
A 8 6

I tried several other solutions,
but neither of them work,
and I get error messages I don't understand.

Can someone enlighten me ?

thanks,
Stef Mientki
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users