[pygtk] problem with TreeView + ListStore

Discussion in 'Python' started by Guillermo Heizenreder, Sep 4, 2007.

  1. 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.
    --
    Heizenreder Guillermo
    http://code.google.com/u/gheize/
    Guillermo Heizenreder, Sep 4, 2007
    #1
    1. Advertising

  2. Guillermo Heizenreder

    Ali Guest

    Re: problem with TreeView + ListStore

    On Sep 4, 10:43 am, Guillermo Heizenreder <> 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/
    Ali, Sep 4, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andre Lerche

    treeview / pygtk problem

    Andre Lerche, Jul 10, 2003, in forum: Python
    Replies:
    3
    Views:
    440
    David M. Cook
    Jul 11, 2003
  2. Franck Pommereau

    [PyGTK] forbid focus of TreeView columns

    Franck Pommereau, Feb 21, 2005, in forum: Python
    Replies:
    0
    Views:
    460
    Franck Pommereau
    Feb 21, 2005
  3. manatlan
    Replies:
    0
    Views:
    424
    manatlan
    Apr 25, 2005
  4. sapo
    Replies:
    0
    Views:
    556
  5. binaryjesus
    Replies:
    1
    Views:
    370
    binaryjesus
    Jul 29, 2008
Loading...

Share This Page