wxPython: some help with Drag&Drop

Jason tenax.raccoon at gmail.com
Mon Mar 10 19:10:50 EDT 2008



Eric von Horst wrote:
> Hi,
>
> I need some advice on Drag&Drop.
>
> What I want to achieve is the following:
> -          I have a window that is divided in two : on the left hand I
> have a wx.TreeCtlr and on the other hand a wx.StaticBitmap
>
> I want to be able to drag an item from the tree onto the static
> bitmap.
>
> I know how to do drag&drop in a treeCtrl but is there a way that I can
> make the bitmap detect that something has been dropped on it?
>
> I would only need to know the name of the tree obj that was dropped on
> the bitmap (and the location)
>
> Any help much appreciated
>
>
>
> Erik

Take a look at the wxPython demo [1].  In the "Clipboard and DnD"
section, there's the "CustomDragAndDrop" demo.  It sounds like that's
exactly what you want.  (It uses the wx.PyDropTarget class to
accomplish this, BTW.)

[1] The demo package for your platform can be found at "http://
www.wxpython.org/download.php#binaries"

  --Jason



More information about the Python-list mailing list