gpt4 book ai didi

click - GtkTreeView 的行右击

转载 作者:行者123 更新时间:2023-12-04 20:22:50 24 4
gpt4 key购买 nike

当用户右键单击树 View 的行时,我该怎么做?

最佳答案

这真的很简单,只需监听“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)

关于click - GtkTreeView 的行右击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4570859/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com