[pygtk] Activate row in TreeView with single click

Timo timomlists at gmail.com
Tue Sep 13 16:48:47 WST 2011


On 09-09-11 21:05, juanma17a wrote:
> Hello,
>
> I am trying to make my TreeView trigger a row-activated signal when a
> row is selected with a single click. How can I do this?
Don't think it's possible, but if you want to execute code when a user 
selects a single line, use the treeselection[1] instead.

Untested:

def selection_changed_cb(selection):
     print selection.get_selected()

selection = treeview.get_selection()
selection.connect('changed', selection_changed_cb)


If you really, really want to emit the row-activated signal, you could 
do so in the above callback, with:
     treeview.emit('row-activated')
But you should probably have enough with the selection changed signal.

Cheers,
Timo

[1] http://developer.gnome.org/pygtk/stable/class-gtktreeselection.html

> Thanks!
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/



More information about the pygtk mailing list