tkinterdnd2 file drag into Gtk3 apps like Nautilus does nothing. The issue is that Gtk3 based apps get the file list in the drop callback by calling data.get_uris() which returns an empty list when the drop source is tkinterdnd2 based. I know that the basic operation is correct because the file name in the Gtk app can be obtained by calling data.get_data(). The problem appears to be how to configure the tkinterdnd2 drag source so that the file list payload can be obtained from data.get_uris() in the Gtk app. The issue is demonstrated with the following apps. If you drag the file from the trkinter source app into the Gtk drop app you will messages to stdout indicating that the transfer was received as a string but not as a uri-list.
**TkinterDnd2 drag source app:
`import os
import platform
from tkinterdnd2 import *
from tkinter import *
root = TkinterDnD.Tk()
root.withdraw()
root.title('TkinterDnD File DnD')
label = Label(root, text='Drag Me')
label.pack(padx=20, pady=20)
def drag_init(event):
return ((LINK), (DND_FILES), ("/tmp/test.txt"))
def drag_end(event):
print('Drag ended for widget:', event.widget)
label.drag_source_register(1, DND_FILES)
label.dnd_bind('<>', drag_init)
label.dnd_bind('<>', drag_end)
root.update_idletasks()
root.deiconify()
root.mainloop()`
**GTK3 drop receive app:
`import gi
gi.require_version("Gdk", "3.0")
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk
window = Gtk.Window()
window.connect("delete-event", Gtk.main_quit)
box = Gtk.HBox()
window.add(box)
def on_drag_data_received(widget, drag_context, x, y, data, info, time):
print("Received uris: {}".format(data.get_uris())) ### returns empty listtkinterdnd2 files could be dropped into Gtk2 based app
print("Received data: {}".format(data.get_data())) ### gets dropped file path
drop_button = Gtk.Button(label="Drop")
drop_button.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.LINK)
drop_button.drag_dest_add_uri_targets()
drop_button.connect("drag-data-received", on_drag_data_received)
box.add(drop_button)
window.show_all()
Gtk.main()`
Upon dragging a test file from the tkinterdnd2 app into the Gtk app the results are displayed to stdout of the latter. It shows that the data.get_data() call obtains the dropped file path but the data.get_uris() call returns an empty list.