我想让 TreeView 中的 gtk.CellRendererPixbuf
可以点击,这样我就可以在用户点击它时调用函数。这可能吗?如何实现?
我正在使用 PyGTK,但可以接受 C 或 PHP 或其他任何语言的答案。谢谢。
最佳答案
GtkCellRenderer 的 C 文档指出:
Beyond merely rendering a cell, cell renderers can optionally provide active user interface elements. A cell renderer can be activatable like GtkCellRendererToggle, which toggles when it gets activated by a mouse click, or it can be editable like GtkCellRendererText, which allows the user to edit the text using a GtkEntry. To make a cell renderer activatable or editable, you have to implement the activate or start_editing virtual functions, respectively.
不幸的是 pyGTK documentation 中缺少此信息, 但信息可在 activate
中找到信号文档。
关于gtk - 如何允许在 TreeView 中单击 pixbuf(图像)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13965090/