Hubro
Hubro

Reputation: 59313

How do I force the Grid to redraw in wxPython?

I have a function that performs some operations on every cell in a column of my grid. The function sets the background color of the cell (SetCellBackgroundColour) based on the results of the operation. My issue is that when the function is complete, the cells remain unchanged. On OSX, only when I scroll down do the cells redraw and appear with color. On windows they don't even redraw then, and I have to select and deselect the cells before they get colored.

How do I force the Grid control to redraw and appear correctly after changing cell background colors?


What I've tried

I've tried to call Layout() on the grid, and on the grid's parent panel, without success.

Upvotes: 0

Views: 1561

Answers (1)

Hubro
Hubro

Reputation: 59313

Figured it out after searching a bit more through the API. I found the method Grid.ForceRefresh that worked perfectly. Just need to call it once after I'm done editing the grid.

Upvotes: 2

Related Questions