[pygtk] Drag and Drop in other non-pygtk Applications on Windows

Matthieu Cadet matthieu.cadet at gmail.com
Wed Feb 23 18:38:44 WST 2011


Hi,

First question, is it possible to make a drag and drop to another non pygtk
application ( such as Notepad or whatever.. )
with the a simple mime type text/plain with pygtk on Windows?

Actually the only thing i've done, is to connect the signal "drag_end" to
the button and print this signal :
<gtk.gdk.DragContext object at 0x1ee24b8 (GdkDragContext at 0x21c5eb0)>

Any help would be appreciate, thanks a lot !

Here is my test code where i'm trying to do this :

########
import pygtk
pygtk.require('2.0')
import gtk

def sendCallback(widget, context, selection, targetType, eventTime):
   print "sendCallback", widget, context, selection, targetType, eventTime

def dragEnd(drag_context, data):
   print "dragEnd", drag_context, data

w = gtk.Window()
w.set_size_request(200, 150)

button = gtk.Button("DATA")
button.connect("drag_data_received", sendCallback)
button.connect("drag_end", dragEnd)
button.drag_source_set(gtk.gdk.BUTTON1_MASK, [ ("text/plain", 0, 0) ],
gtk.gdk.ACTION_COPY)

w.add(button)
w.show_all()

gtk.main()
########
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.daa.com.au/pipermail/pygtk/attachments/20110223/7f235198/attachment.html>


More information about the pygtk mailing list