However, this message will tell wx.Grid object to refresh all its
display values, which tend to be somewhat slow. If I know exactly
which cell has its value changed, how can I request wx.Grid to refresh
only that cell?
However, this message will tell wx.Grid object to refresh all its
display values, which tend to be somewhat slow. If I know exactly
which cell has its value changed, how can I request wx.Grid to refresh
only that cell?
Something like this should do it:
grid = self.GetView()
rect = grid.CellToRect(row, col)
rect.SetPosition(grid.CalcScrolledPosition(rect.GetPosition()))
grid.GetGridWindow().RefreshRect(rect)
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
grid = self.GetView()
rect = grid.CellToRect(row, col)
rect.SetPosition(grid.CalcScrolledPosition(rect.GetPosition()))
grid.GetGridWindow().RefreshRect(rect)
That works. And I found that the code below also works:
grid = self.GetView()
rect = grid.BlockToDeviceRect((row, col), (row, col))
grid.GetGridWindow().RefreshRect(rect)
Is there any difference between the two?
No, they are essentially the same. Using BlockToDeviceRect will let you
include a range of cells if needed, and does some validation to ensure
that the range of cells is actually visible before returning the rectangle.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!