wxgrid Optimization

I have a python application which uses lot of wxgrid.
Each grid is displaced in a tab and there are multiple table.

I have to update multiple cell of a row at a time, so is there any way, I can decrease number of table refresh like 1 refresh for all cell update of a row.

Ankit Jain wrote:

I have a python application which uses lot of wxgrid.
Each grid is displaced in a tab and there are multiple table.
I have to update multiple cell of a row at a time, so is there any way,
I can decrease number of table refresh like 1 refresh for all cell
update of a row.

There are BeginBatch and EndBatch methods which will suspend redraws and some other operations after BeginBatch until EndBatch is called.

If you haven't already then you should also look at providing the data in your own table class. Then you don't have to update each cell individually via the Grid methods, instead you just update your data in place in whatever underlying data structures you are using and the grid will then ask for the values as it needs them for display. If you have changing data then this is usually a more efficient way to manage that.

···

--
Robin Dunn
Software Craftsman

Thanks for solution, I will be incorporate both solution in my final as they are providing better result.

I have tried both the approach provided by you. So there are 4 permutation.

I am having few issue with Second Approach.

  1. If I am using only using table(getTable), I am not able to see changes without any external change like dragging.

  2. When I am using BeginBatch with getTable, It is not providing me with best solution.

gridTestCode.py.txt (2.86 KB)

···

On Friday, January 31, 2014 8:11:16 AM UTC+5:30, Robin Dunn wrote:

Ankit Jain wrote:

I have a python application which uses lot of wxgrid.

Each grid is displaced in a tab and there are multiple table.

I have to update multiple cell of a row at a time, so is there any way,

I can decrease number of table refresh like 1 refresh for all cell

update of a row.

There are BeginBatch and EndBatch methods which will suspend redraws and
some other operations after BeginBatch until EndBatch is called.

If you haven’t already then you should also look at providing the data
in your own table class. Then you don’t have to update each cell
individually via the Grid methods, instead you just update your data in
place in whatever underlying data structures you are using and the grid
will then ask for the values as it needs them for display. If you have
changing data then this is usually a more efficient way to manage that.


Robin Dunn

Software Craftsman

http://wxPython.org