You have half answered your question. Just coded and tested my code, so I did not find any point in posting my fragment of the solution.def init(self):
"""initialise dialog"""
self.tree.bind("<Button-3>", self.popup)
def popup(self, event):
"""action in event of button 3 on tree view"""
iid = self.tree.identify_row(event.y)
if iid:
self.tree.selection_set(iid)
self.contextMenu.post(event.x_root, event.y_root)
else:
pass
source
share