wx.grid.Grid doesn't refresh row count

Aliaksei Hayeu alex_de_guy at tut.by
Tue Jul 4 07:41:21 PDT 2006


Hi!

  I use wx.grid.Grid to display my table. It goes something like this:

...
class MyTable( wx.PyGridTableBase ):
    def __init__( self, dic ):
        wx.grid.PyGridTableBase.__init__(self)
        self.theDic = dic
    def GetNumberRows( self ): return len(self.theDic)
    ...
class MyGrid( wx.grid.Grid ):
    def __init__( self, parent, dic ):
        wx.grid.Grid.__init__(self,parent)
        self.SetTable(MyTable(dic))
        ...
    ...
...

  In the course of program I change the contents of dic, that lies beneath all these controls. Then why MyGrid's number of rows doesn't change, even though I call MyGrid.ForceRefresh() and MyTable.GetNumberRows() returns correct new number of rows? MyGrid displays new values OK, but then I scroll beyond the new limits and get a whole bunch of IndexErrors...
  I'm using wxpython-win32-unicode-2.6.3.2-py24.

Bye!
A. D. G. (http://alexdeguy.nm.ru) (ICQ: 154305887)





More information about the wxpython-users mailing list