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

John Finlay finlay at moeraki.com
Sun Oct 18 03:43:15 WST 2009


Taras wrote:
> 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?
>
>   
I don't think there is a built-in way to connect to a clicked event on a 
TreeView cell.

John


More information about the pygtk mailing list