Here's how I do it. You can convert the path to an iter
to get the row data if you like.

Stephen.

def on_treeview_button_press_event(self, treeview, event):
    # unselect others
    if event.button == 3:
        path, col, cellx, celly = treeview.get_path_at_pos(
int(event.x), int(event.y) )
        treeview.grab_focus()
        treeview.set_cursor( path, col, 0)
        self.popup.popup( None, None, None, 3,
gtk.get_current_event_time() )
        return 1


> Hi,
>   I'm pretty new to the GtkTreeStore/View in  PyGTK. I made a TreeView
> and have added a TreeStore to it and I can fill it up with data.
> 
> However I would like to set it so that right clicking on a row brings up
> a pop up menu. I tried connect()'ing to the result of
> view.get_selection() and supplying my own function. The function
> recieves a TreeSelection object but I'm not sure as to how I can get the
> row data out of that selection object.
> 
> Furthermore the callback is triggered on any mouse click. Is there
> anyway to only accept a right click?
-- 
Stephen Kennedy <[EMAIL PROTECTED]>
http://meld.sf.net visual diff and merge

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to