title: The OLE way of doing drag&drop in wxPython
body: <p>I have wxPython app which is running on MS Windows and I'd like it to support drag&amp;drop between its instances (so the user opens my app 3 times and drags data from one instance to another).</p>
  
  <p>The simple drag&amp;drop in wxPython works that way:</p>
  
  <ol>
  <li><strong>User initiates drag</strong>: The source window packs necessary data in wx.DataObject(), creates new wx.DropSource, sets its data and calls dropSource.DoDragDrop()</li>
  <li><strong>User drops data onto target window</strong>:  The drop target calls library function GetData() which transfers actual data to its wx.DataObject instance and finally - dataObject.GetData() unpacks the actual data.</li>
  </ol>
  
  <p>I'd like to have some more sophisticated drag&amp;drop which would allow user to choose what data is dragged <strong>after</strong> he drops.<br>
  Scenario of <em>my dreams</em>:  </p>
  
  <ol>
  <li><strong>User initiates drag</strong>: Only some pointer to the source window is packed (some function or object).</li>
  <li><strong>User drops data onto target window</strong>: Nice dialog is displayed which asks user which drag&amp;drop mode he chooses (like - dragging only song title, or song title and the artists name or whole album of the dragged artist).</li>
  <li><strong>Users chooses drag&amp;drop mode</strong>: Drop target calls some function on the dragged data object, which then retrieves data from the drag source and transfers it to the drop target.</li>
  </ol>
  
  <p>The scenario of my dreams seems doable in MS Windows, but the docs for wxWidgets and wxPython are pretty complex and ambigious. Not all wx.DataObject classes are available in wxPython (only wx.PySimpleDataObject), so I'd like someone to share his experience with such approach. Can such behaviour be implemented in wxPython without having to code it directly in winAPI?</p>
  
  <p>EDIT:
  Toni Ruža gave an answer with working drag&amp;drop example, but that's not exactly the scenario of <em>my dreams</em>. His code manipulates data when it's dropped (the <strong>HandleDrop()</strong> shows popup menu), but data is prepared when drag is initiated (in <strong>On_ElementDrag()</strong>). In my application there should be three different drag&amp;drop modes, and some of them require time-consuming data preparation. That's why I want to postpone data retrieval to the moment user drops data and chooses (potentially costly) d&amp;d mode.</p>
  
  <p>And for memory protection issue - I want to use OLE mechanisms for inter-process communication, like MS Office does. You can copy Excel diagram and paste it into MS-Word where it will behave like an image (well, sort of). Since it works I believe it can be done in winAPI. I just don't know if I can code it in wxPython.</p>