TkinterDnD2

TkinterDnD2 is a python wrapper for George Petasis' tkDnD Tk extension version 2.
Please note that it will not work with the tkdnd1.0-series.
tkDnD2 adds native drag and drop support for windows and (yet partially) unix and Mac OSX to Tk. TkinterDnD2 makes this functionality available for Tkinter.
If you want to use TkinterDnD2 you will of course have to install tkDnD2 first. Windows binaries as well as the sources can be found here.
TkinterDnD2-0.1 is only a first prototype, so please be careful using it for production code.
The distribution contains a little demo script that shows how I managed to drop files from Explorer onto a Tkinter Listbox. I have not yet succeeded dragging from Tk.
It has been reported that to be able to drag files onto Tkinter widgets on Mac OSX you have to change the datatype in the demo script from CF_TEXT (which appears to be MS windows specific) to DND_TEXT.
On unix, dragging is not yet implemented in tkDnD2, dropping should work, however I could not yet manage to make it work here (on debian linux).

Besides the classes described in the reference manual the package defines the following (hopefully useful) constants:
PRIVATE = 'private'
NONE = 'none'
ASK = 'ask'
COPY = 'copy'
MOVE = 'move'
LINK = 'link'
REFUSE_DROP = 'refuse_drop'
DND_TEXT = 'DND_Text'
DND_FILES = 'DND_Files'
DND_ALL = '*'
CF_UNICODETEXT = 'CF_UNICODETEXT'
CF_TEXT = 'CF_TEXT'
CF_HDROP = 'CF_HDROP'
FileGroupDescriptor = 'FileGroupDescriptor - FileContents'
FileGroupDescriptorW = 'FileGroupDescriptorW - FileContents'

Any comments, bug reports or even fixes are highly appreciated.
Please contact: Michael Lange <klappnase (at) users (dot) sourceforge (dot) net>

License

TkinterDnD is released in the public domain.

Download

Here you can download the latest version of TkinterDnD2.