Skip to content

tkinter inter-windows drag and drop support

I’m trying to help the owner of tkdnd generate a wheel and distribute it to Pypi so users could simply install the tkdnd extension with a simple pip install TkinterDnD2.

I’m after this ‘challange’ for the last two days but could not solve it by myself so far, but I’m sure someone with a deep understanding python packaging and installing process could help as solve it in short time.

currently in order to get this extension work you need to do the following steps(as mentioned here):

  1. download the compiled tkdnd files for your os. now go to your base interpreter directory/tcl and copy this folder under. for example:

notice – it did not work for me if I created a matching tcl/tkdnd2.9.2 directory in the venv of the project the imported TkinterDnD2

  1. now download the python wrapper and add it you your venv site-packages directory(or base interpreter it’s doesn’t matter). so the python project which will import TkinterDnD2 will look like this:

now one could successfully run tkdnd extensions.

you can probably tell this is not much like installing the average python library. the problematic thing here is that the extra tkdnd2.9.2 folder is required to be in the tcl folder of your base interpreter.

maybe it is possible to use the package_data and data_files in the to tell python to add this tcl files during the installation from the wheel, but I’m not sure. see Packaging and distributing projects for full reference.

the incomplete

import setuptools

with open("", "r", encoding="utf-8") as fh:
    long_description =

    description="TkDND is an extension that adds native drag & drop capabilities to the Tk toolkit.",
        "Bug Tracker": "",
        "Programming Language :: Python :: 2",
        "Programming Language :: Python :: 3",
        "Operating System :: OS Independent",
    python_requires=">=2, >=3",
    # some extra logic probably belong here
    # ...     

you can track the issue here which includes some extra discussions.

very helpful stackoverflow questions:

  1. How to avoid building C library with my python package?
  2. How to Install and Use TkDnD with Python Tkinter on OSX?

very helpful guides:

  1. Packaging and distributing projects
  2. Packaging Python Projects
  3. Python Bindings: Calling C or C++ From Python

any help would be very appreciated!



Just answering for the case someone else got stuck on it for weeks like I did.

You can see dist repo that pmgagne created here:

The package is not yet published on pypi but you can build a wheel and install it following the instructions on this issue I opened:

Hopefully, the author will build and publish it soon, so you could simply do python -m pip install tkinterdnd2 and enjoy tkinter inter-windows drag and drop support!

If you don’t want to build it your self here’s a wheel download: extract zip and then you can do python -m pip install tkinterdnd2-0.3.0-py2.py3-none-any.whl and then you will be able to import tkinterdnd2 in your python project.


the author did not respond so I forked it published it myself. you can now install simply using

pip install tkinterdnd2


1 People found this is helpful