problem with TreeView + ListStore

Ali aafshar at gmail.com
Tue Sep 4 10:30:37 EDT 2007


On Sep 4, 10:43 am, Guillermo Heizenreder <ghe... at gmail.com> wrote:
> Hi list
> I'm developing a application for learn pygkt, and I need to know when a
> user selected or clicked one determinate row of my TreeView for shot
> another signal .

Hi,

Well, ignoring the rest of the post, I can tell you that the usual way
of
doing this is to connect the changed signal of the treeview's
selection.

This explains it better than I would:

http://faq.pygtk.org/index.py?req=show&file=faq13.011.htp

Now to complete your actual use case:

def on_selection_changed(selection, *args):
     model, paths = selection.get_selected_rows()
     if paths:
        hbox.show()

treeView = gtk.TreeView()
selection = self.treeView.get_selection()
selection.connect('changed', on_selection_changed)

There are some situations where you may want to actually connect the
mouse click event, and we can discuss them further if you require.

I should of course mention kiwi.ui.objectlist.ObjectList. It is an
easier to use abstraction over TreeView, and has helped me in every
situation where I would use a TreeView.


Ali

> Study the tutorial [1] I began to see the explanation that I see in the
> chapter 14.7. TreeView Signal and found one in particular
> "select-cursor-row", but I don't understood  how implementing.
>
> Something like that.
>    if user_selected_row:
>       self.hbox_118.show()
>       print "YES"
>
> NOTE: self.hbox_118 = wTree.get_widget("hbox118")
>
> Thank and Regard
>
> [1]http://www.pygtk.org/pygtk2tutorial/sec-TreeViewSignals.html
>
> P/D: my English it to bad, I'm a novice.
> --
> Heizenreder Guillermohttp://code.google.com/u/gheize/





More information about the Python-list mailing list