israel-dryer / ttkbootstrap

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

Add selection_changed event to TableView #509

Open Aareon opened 1 year ago

Aareon commented 1 year 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 1 year 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 1 year 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.