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)
Hi Aliaksei,
Have you seen this in the wiki:
http://wiki.wxpython.org/index.cgi/UpdatingGridData
i.e. you need to tell the grid that things have changed.
Werner
Aliaksei Hayeu wrote:
···
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)
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org