Hi all,
I'm looking to implement drag/drop that supports both text and files. Here's what I have so far:
class FileDropTarget(wx.PyDropTarget):
def __init__(self):
wx.PyDropTarget.__init__(self)
self.do = wx.DataObjectComposite()
self.do.Add(wx.FileDataObject())
self.do.Add(wx.TextDataObject()) self.SetDataObject(self.do)
def OnDrop(self, x, y):
print self.do.GetReceivedFormat()
def OnData(self, x, y, d):
self.GetData()
return d
## somehow forward to these depending on object type
def OnDropText(self, x, y, text):
pass
def OnDropFiles(self, x, y, filenames):
pass
it prints the following, regardless of whether I'm pasting text/image/bitmap:
<wx._misc.DataFormat; proxy of <Swig Object of type 'wxDataFormat *' at 0x1e49ed0> >
Am I just going about this the wrong way? I can't find any examples of the DataObjectComposite, apart from the wxWidgets docs saying to use the object directly, not sub-class it, as I initially did.
Thanks,
···
--
Steven Sproat, BSc
http://www.basicrpg.com/