gtk树视图单击回调
我有一个像列表视图一样使用的 gtk 树视图,我想给它一个回调,当用户单击(单击,而不是双击)其中的单个条目时激活该回调。我知道树视图小部件的激活回调会在双击时激活,如果我只能设置 gtk.gdk.event 以单击整个树视图小部件,那么这不是我正在寻找的行为。此外,它内部的 cellrenderer 对象不会继承小部件类,这使得我无法特别向该对象提供回调。有人可以告诉我如何在 gtk 树视图中单击某个项目时获得回调吗?
PS 任何语言都可以,但我更喜欢 python,因为我的应用程序就是用 python 编写的。
I have a gtk treeview that I'm using like a list view and I want to give it a callback that activates when the user clicks (single click, not double click) a single entry in it. I know the activated callback for the treeview widget activates for double clicks, and if I have only been able to set up the gtk.gdk.event for single click on the entire treeview widget witch is not the behavior that I'm looking for. Further more the cellrenderer objects inside it don't inherit the widget class which makes it so I can't give the callback to that one in particular. Can someone please tell me how to get the callback for a single click on an item in a gtk treeview working?
P.S. Any language is fine, but I would prefer python since that's what my app is written in.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在树视图中使用 gtk.SELECTION_SINGLE 或 gtk.SELECTION_MULTIPLE,则单击左键即可选择该行。您可以使用 set_select_function 或附加到已更改< /a> 信号。
If you are using a gtk.SELECTION_SINGLE or gtk.SELECTION_MULTIPLE with your treeview, a single left-click would select the row. You can attach to this event by using the set_select_function or attaching to the changed signal.