[pygtk] problem with TreeView + ListStore

  • Thread starter Guillermo Heizenreder
  • Start date
G

Guillermo Heizenreder

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 .

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.
 
A

Ali

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top