Hi murat,
First are you sure you need to know which row is selected?
Then,
You can check if the selected path is in
gtk.Treeview.get_selection().get_selected_rows().
You retrieve the selected path using the signal emitted by
gtk.Treeview.connect('clicked',self.on_treeview_button_press_event) and
the position of the button clicked.
def on_treeview_button_press_event(self, treeview, event):
#get the path for the click
path = treeview.get_path_at_pos(int(event.x),int(event.y))
# get the selected rows in the selection
rows = treeview.get_selection().get_selected_rows()
if path != None:
if path[0] not in rows[1]:
# not clicked on a current selected rows. Change
selection
selection.unselect_all()
selection.select_path(path[0])
For your need, the line path =
treeview.get_path_at_pos(int(event.x),int(event.y)) is enough.
I invite you to read the pygtk faq.
Hope it will help you.
Regards,
Philippe Collet
Message: 6
Date: Sun, 09 Oct 2005 20:43:00 +0300
From: Murat Kasikcioglu <[EMAIL PROTECTED]>
Subject: [pygtk] treeview - handle mouse click - selected row
To: [email protected]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
hi all,
i'm a newbie using pygtk.
i could not find a solution howto use a treeview object.
my problem is how i can handle which row is clicked.
any suggestion is welcome.
regards,
murat.
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/