[pygtk] Receiving click events on a CellRendererPixbuf
Osmo Salomaa
otsaloma at iki.fi
Mon May 16 06:19:53 WST 2011
su, 2011-05-15 kello 15:31 -0600, John Haiducek kirjoitti:
> That had occurred to me, but I was hoping there was a simpler way
> (unless it's not so complicated as I thought to figure out which
> coordinates are inside the cell).
Tree view's 'row-activated' will send the path and column as arguments
to the callback. With 'cursor-changed' you just need to call
gtk.TreeView.get_cursor to find out the path and column. With
gtk.Widget's 'button-press-event' you get the event as an argument for
the callback and you just need to call gtk.TreeView.get_path_at_pos with
event.x and event.y to get the path and column.
I don't know if that's easier than some alternative, but it's no more
than two or three lines of code in a callback. I vaguely remember using
gtk.GenericCellRenderer being difficult and there's a good chance of
breakage with new versions of GTK+ if you have to write the rendering
etc. code yourself -- I stumbled on this a couple times. Can you get the
'on-activate' signal if you subclass gtk.CellRendererPixbuf?
--
Osmo Salomaa <otsaloma at iki.fi>
More information about the pygtk
mailing list