当用户右键单击树视图的行时,我该怎么做?
问问题
3250 次
1 回答
3
这真的很简单,只需听“button-press-event”信号并使用treeview.get_path_at_pos()
来计算选定的行:
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)
于 2011-09-27T09:11:37.727 回答