3

I want to make my gtk.CellRendererPixbuf in the treeview clickable so that I can call a function when user clicks on it. Is this possible and how can this be done?

I'm working with PyGTK, but answers in C or PHP or anything else would be acceptable. Thanks.

liberforce
  • 11,189
  • 37
  • 48
elwc
  • 1,197
  • 2
  • 15
  • 25

1 Answers1

2

The C documentation of GtkCellRenderer states that:

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.

What is unfortunate is that this information is missing from the pyGTK documentation, but the information is available in the activate signal documentation.

liberforce
  • 11,189
  • 37
  • 48
  • Tried it earlier but faced some problem. I will try it later and accept this as an answer when it works. Thanks again. – elwc Dec 26 '12 at 01:28
  • I am struggling to use `activate()`. Any help will be much appreciated – elwc Jan 16 '13 at 03:07
  • Just give a look to GTK source code for examples. Here's how the activate signal is implemented for GtkCellRendererToggle: http://git.gnome.org/browse/gtk+/tree/gtk/gtkcellrenderertoggle.c?id=2.24.14#n393 – liberforce Jan 16 '13 at 09:18
  • TypeError: : unknown signal name: activate – ilias iliadis Dec 23 '18 at 01:31