I want that whenever my chooses me gtk.TreeView, and when he does this, the w / this information function is called. The only way I've found this so far is to bind to all of these signals:
...
self.sitterView.connect("cursor-changed", self.selectionChanged)
self.sitterView.connect("unselect-all", self.selectionChanged)
self.sitterView.connect("toggle-cursor-row", self.selectionChanged)
self.sitterView.connect("select-all", self.selectionChanged)
...
def selectionChanged(self, treeview):
foo(self.sitterView.get_selection().get_selected())
However, it seems that the choice I get from the callback is “delayed”. That is, it shows the selection after completing the previous callback. For example, if I constantly press CTRL + on a line when the line goes from selected to selected, foo gives no choice, and when the line goes from selected to deferred, it is assigned a choice. If I call a get_selection().get_selected()second later, I get the right choice. Any idea how to handle this?
source
share