pygobject creating a drag and drop source
问题 from gi.repository import Gtk, Gdk def drag_data_get_cb(widget, drag_context, selection_data, info, time): print selection_data.get_data_type() print widget.get_text() return widget.get_text() def drag_begin_cb(widget, dragcontext): print dragcontext, widget return dragcontext label = Gtk.Label() label.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, [], Gdk.DragAction.COPY) label.set_text("Drag Me!") label.connect("drag_data_get", drag_data_get_cb) label.connect("drag_begin", drag_begin_cb)