10

What is the correct/official/proper/recommended way of accomplishing drag/drop in tkinter? My documentation section 24.1.1 includes:

Tkdnd Drag-and-drop support for Tkinter. This is experimental and should become deprecated when it is replaced with the Tk DND.

but I can find no other official documentation. Does Tkinter have drag/drop support at all? Is this something version dependant? Is this something not yet included in tk(tcl) which will then filter through to tkinter?

I should stress that I am talking about drag/drop between different applications and that I am currently using python 2 (although any solution which relies on python 3 would still be of interest).

nbro
  • 15,395
  • 32
  • 113
  • 196
Richard
  • 335
  • 1
  • 2
  • 13
  • There's been some development - here's a solution: https://stackoverflow.com/questions/14267900/python-drag-and-drop-explorer-files-to-tkinter-entry-widget – nda Jun 21 '18 at 18:39

2 Answers2

7

Tkinter has no built-in support for dragging and dropping between applications. Tkdnd is, AFAIK, the only way to accomplish it without writing the low level code yourself.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • 1
    Thanks for the fast response. From the quoted documentation, may I assume that _tkdnd_ and _tk dnd_ are two separate things? – Richard Apr 22 '13 at 14:40
6

Check out this module, D&D with TK and Python 3.

cdonts
  • 9,304
  • 4
  • 46
  • 72
  • 4
    I know links aren't especially popular on SO, but this write-up was of great value figuring out how dnd works [Tkdnd](http://www.bitflipper.ca/Documentation/Tkdnd.html) – Robert Lugg Sep 19 '14 at 09:03