On 6/21/05, N. Volbers <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> Prash wrote:
> > What signal is emitted when a user clicks on a row? I've tried a few
> > like row_activated but it emits a signal only when "return" is
> > pressed.

If you want to find out when the user has changed which row is
selected (i.e. highlighted or unhighlighted a new row or rows), you
want to connect to the 'changed' signal of the selection object. The
TreeView provides a get_selection method to get the selection object,
useful for this and various other tasks (like getting the actual
selected rows, etc.)

You can connect like so...

tv = gtk.TreeView()
tv.get_selection().connect('changed',my_handler)

You could also of course first bind the selection to a variable. Does
anyone know if this is more or less efficient for cases when you want
to use the selection more than once?  In other words, is it better to
do:

sel = tv.get_selection()
sel.connect('changed',...)
rows = sel.get_selected_rows()
etc.

or to do:

tv.get_selection().connect('changed',...)
rows = tv.get_selection().get_selected_rows()
etc.

Or does it make no difference?

And one final question -- any change that the 2.8 bindings could allow
us simply to access the selection as an attribute without having to
call a method? I'd find it much cleaner simply to write:

tv.selection.connect('changed',...), etc.

Tom
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to