gtk - 如何允许在 TreeView 中单击 pixbuf(图像)?

标签 gtk pygtk clickable gtk2

我想让 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/

相关文章:

linux - 你如何知道 Ubuntu 上安装了哪个版本的 GTK+?

python - 如何转义 Pango 标记中的字符?

android - 长按监听器以停用 View

css - 脱节的可点击文本翻转

c++ - 你如何在 SFML 中制作可点击的 Sprite ?

c# - Gtk# 有键值枚举吗?

Glade/GTK 的 CSS

python - 如何在PyGTK中的gtk.CellRendererPixbuf上实现activate()函数?

windows - Windows 上的 Python + webkit + gtk

c - 使用 gtk 进行多任务处理