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?

  • Close voters: This is not off-topic, questions about development on Ubuntu are on-topic. – Seth Apr 10 '14 at 22:26
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.