Thanks to Alex Tweedly's post a few years back and pointed to:
http://wiki.wxpython.org/index.cgi/DragAndDropWithFolderMovingAndRearranging
I did it using Pythoncard style:
class FileDropTarget(wx.FileDropTarget):
def __init__(self, parent, obj):
wx.FileDropTarget.__init__(self)
self.parent = parent
self.obj = obj
def OnDropFiles(self, x, y, filenames):
try:
exec "self.parent.on_%s_DropFiles(x, y, filenames)"%self.obj.name
except:
pass
return
class MyClass(Minimal):
def on_initialize(self, event):
Minimal.on_initialize(self, event)
self.components.tree.SetDropTarget(FileDropTarget(self, self.components.tree))
def on_tree_DropFiles(self, x, y, filenames):
print filenames
This works. The only problem is that I don't know how to figure out who the dropped target is (in other words: which branch or item the dragged file was dropped onto) and so I can only assume that the selected item is the dropped target. Does anybody know how to figure out the dropped target?
--
John Henry
----- Original Message ----
> From: John Henry <ec...@ya...>
> To: pyt...@li...
> Sent: Mon, October 19, 2009 8:46:11 PM
> Subject: Drag-&-drop from the Windows Explorer?
>
> Hi list,
>
> Is it possible to accept a Drag-n-drop event from the IE running under Windows?
> In other words, if I drag a file from the drive folder and drop it onto a
> Pythoncard window, is there a way to raise an event and get, perheps the name of
> the file?
>
> If so, does anybody has any sample code?
>
> Thanks,
>
> --
> John Henry
|