Hi,

I'm migrating an application to Python 3, GTK+ 3 and the PyGI bindings.
I'm having trouble with drag and drop, which I would need for opening
files dragged from a file browser. I have the following minimal example,
which I have translated my old code to the new APIs, but it doesn't seem
to work. The Window is not receiving any drag events. Am I using
Gtk.TargetEntry and friends correctly?

    #!/usr/bin/env python3
    from gi.repository import Gdk
    from gi.repository import Gtk
    window = Gtk.Window()
    window.drag_dest_set(Gtk.DestDefaults.ALL,
                         [Gtk.TargetEntry.new("text/uri-list", 0, 0)],
                         Gdk.DragAction.COPY)

    window.connect("drag-data-received", lambda *args: print(args))
    window.resize(500, 500)
    window.show_all()
    window.connect("delete-event", Gtk.main_quit)
    Gtk.main()

-- 
Osmo Salomaa <otsal...@iki.fi>
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to