israel-dryer / ttkbootstrap

A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
MIT License
1.89k stars 381 forks source link

TableView supporting row/colume/cell selection #542

Open yxdragon opened 7 months ago

yxdragon commented 7 months ago

Is your feature request related to a problem? Please describe.

I found TableView did not support select by colume or cell (just like excel) and may have sume performance problem when render a large dataframe with many rows and columes. So I want to build a new TableView supporting selected by row/col/cell, editing cell, and render large dataframe.

Describe the solution you'd like

So I wrote one with canvas, I draw everything by canvas, now it is just ok!

  1. a virtual view, which can draw very large data smoothly, (just draw the rows needed)
  2. select by row, colume or cell (ctrl to invert selection and shift to union selection like excel).
  3. adjust row height and colume width when cursor in the header sep.

but now I do not know how to implements editing. (when double click a cell, select and highlight the background, with cursor flashing)

Describe alternatives you've considered

  1. I can draw the highlight background, even I can draw the cursor flashing in after function recursively.
  2. I can also place a Entry in the cell, But then I need to manage the size, border, and background. re place it when ever the canvas scrolled.

But I think the both are not the best way. any good suggestions?

Additional context

1708963023373 1708963092170 tableview.txt

Is it useable for ttkbootstrap when completed? It could be called GridView.

sambler commented 4 months ago

@yxdragon I found a way to make treeviews editable. You locate the position of the cell to be edited, then create an Entry and use place() to position it with x,y,width,height so that it is exactly over the cell.

See my EditTree project for an example.