[pygtk] How to add 'clicked' event to treeview cell?

Taras naplanetu at gmail.com
Sat Oct 17 18:38:01 WST 2009


Hello, all!


There is a table with some rows. For example, it has 3 columns. 
The first one is icon column 'Add/Remove to favorites' with star icon.
I read about pixbuf renderer but I can't find how can I connect
'clicked' event to this column :( I also research how it made in Exaile
(music player written in Python/GTK). 

There is workaround with:
...
  self.list.connect('button-release-event', self.update_rating)
...
and
...
     (x, y) = e.get_coords()
       #check if the click is within rating column and on a list entry
         if self.list.get_path_at_pos(int(x), int(y)) \
             and left_edge < x < left_edge + rating_col_width:
...
But it looks like unbeautiful workaround. Is there more beautiful
solution to connect 'clicked' event to icon cell?

Thanks for answers!



More information about the pygtk mailing list