tksheet icon indicating copy to clipboard operation
tksheet copied to clipboard

Flickering when modifying row data

Open multizone-quant opened this issue 3 years ago • 2 comments

Thanks for tksheet to use.

I have a question on flickering issue. I use set_row_data() to modify the data at the specific row. and then use refresh() to show on the screen

At that time whole data in the table are displayed again with flickering.

Here is the question. Is is possible to display only update row without flickering? or is it possible to display data without clear whole data in the table when i call refresh()?

Thank in advance.

multizone-quant avatar Nov 11 '22 06:11 multizone-quant

I found the reason why flicking occurred. There is problem on the following function, main_table_redraw_grid_and_text()

the widget which returned from self.hidd_text.popitem() does not match the loop variables, (c, r). The returned widget is from the last one and (c,r) is incrementing from 0,0.

def main_table_redraw_grid_and_text(self, redraw_header = False, redraw_row_index = False, redraw_table = True):
    :
    if redraw_table:
        for c in range(start_col, end_col - 1):
            for r in rows_:
                             :
                            if self.hidd_text:
                                t, sh = self.hidd_text.popitem()

multizone-quant avatar Nov 15 '22 06:11 multizone-quant

This is intended and is not the reason for flickering, the popped item is configured with new settings and any left over items are hidden. Items are only created and then recycled, this is how items are redrawn without deleting and creating potentially millions of items which would eventually slow down the tkinter canvas.

I’m not sure why you’re having flickering though, are you using set_row_data() very often? you can use it with redraw = True in order to only refresh the table a single time after all your data setting has completed.

ragardner avatar Mar 13 '23 16:03 ragardner