3

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?

1
  • Close voters: This is not off-topic, questions about development on Ubuntu are on-topic.
    – Seth
    Apr 10, 2014 at 22:26

1 Answer 1

1

To get the path, you should be able to do something like this (untested):

    def on_iconview_selection_changed(self, widget):
        try:
            path = widget.get_selected_items()[0]
        except IndexError:
            # No icon selected, so the list returned by get_selected_items() is
            # empty and indexing returns an IndexError
            path = None

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .