israel-dryer / ttkbootstrap

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

Add selection_changed event to TableView #509

Open Aareon opened 7 months ago

Aareon commented 7 months ago

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

I have a need for responding when table selection changes, such as updating a num selected label.

Describe the solution you'd like

A bindable event for when table selection changes.

Describe alternatives you've considered

Other features I've considered are embedding a check button inside a table element to select a row. This did not work as I expected, but I figured an event would be much more versatile.

Additional context

No response

Aareon commented 7 months ago

Binding Button-1 and KeyRelease on tableview.view, I have found that getting the selection does not work as expected on the first event. I've tried using tableview.view.update then tableview.view.selection() to no avail. Getting the selection requires clicking twice. See below GIF.

NVIDIA_Share_oocBb7TS46

Aareon commented 7 months ago

I've also noticed that tableview.insert_row("end", ["value1", "value2", "value3"]) does not work, at least on 3.12. tableview.view.insert_row() does work as expected.