Right click GtkTreeView right row

How do I do something when the user right-clicks in a tree row?

+4
source share
1 answer

It is very simple, just listen to the button-press-event signal and use treeview.get_path_at_pos() to display the selected row:

 def button_press_event(treeview, event): if event.button == 3: # right click model, path = treeview.get_path_at_pos(int(event.x), int(event.y)) # do something with the selected path treeview.connect('button-press-event' , button_press_event) 
+4
source

Source: https://habr.com/ru/post/1333898/


All Articles