Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygtk
- pygtk.require('2.0')
- import gtk
- w = gtk.Window()
- w.drag_set_set(0, [], 0)
- w.connect('drag_motion', motion_cb)
- w.connect('drag_drop', drop_cb)
- w.connect('drag_data_received', got_data_cb)
- w.connect('destroy', lambda w: gtk_main_quit())
- l = gtk.Label()
- l.set_text('Drag File Here')
- w.add(l)
- w.show_all()
- gtk.main()
- def motion_cb(wid, context, x, y, time):
- context.drag_status(gtk.gdk.ACTION_COPY, time)
- return True
- def drop_cb(wid, context, x, y, time):
- wid.drag_get_dta(context, context.targets[-1], time)
- return True
- def got_data_cb(wid, context, x, y, data, info, time):
- # the following line returns a URI? I want the absolute file path
- print data.get_text()
Add Comment
Please, Sign In to add comment