Question

I am building a file browser using Gtk.IconView in python. I am trying to find the path of an icon selected using " selection-changed" signal using gtk.IconView.get_path_at_pos(x,y).

The docs are mum on how to obtain the (x,y). How do I find them?

using python 2.7 and pygtk 2.24

Was it helpful?

Solution

You don't use get_path_at_pos. It is meant for cases where you handle the button presses directly (which you should avoid unless you really have good reasons to do so).

Simply use gtk_icon_view_get_selected_items (C) or the pygtk equivalent iconview.get_selected_items() which gives you a list (in C a GList) of currently selected Gtk.TreePaths which is what you desire.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top