Treeview with multiple selection: Enter key DEselects all rows except for the last-selected one

Context: Treeview with multiple-selection enabled.
Problem: pressing the Enter key DEselects all rows except for the last-selected one


  • In the GUI only one row remains selected
  • Inside the row_actived callback, counting the number of selected row(s) returns = 1 (see code below).
  # This is the Treeview `row_activated` callback
  def treeview_on_row_activated(self, treeview, row_path, treeviewcolumn):
        treeselection = treeview.get_selection()
        model, pathlist = treeselection.get_selected_rows()
        if pathlist:
            print("Number of selected row(s):  " + str(len(pathlist)))
            for path in pathlist:
                # do something on all the selected rows

I don’t want to loose the information about the selected rows when I click the Enter key. Instead I would like to perform some action on ALL the previously selected rows (not only the last-selected one).

1 Like

Can you post a minimal example of the issue? :slight_smile:

As far as I know you’ll need to set your own select function in order to do something like that.

Example of setting your own select function to do something similar

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.