skillfed

tkinterdnd2

TkinterDnD2 is a python wrapper for George Petasis'' tkDnD Tk extension version 2

tkinterdnd2 v0.6.2 273.9K downloads/30d#8,195 on PyPI59
Permissive license Active released

What it is and what it does

tkinterdnd2 is a Python wrapper around the tkDnD Tk extension that enables native drag-and-drop functionality in Tkinter applications. It allows you to register widgets as drop targets and bind handlers to receive dropped files or data, with support for Windows, macOS, and Unix. The package bundles precompiled tkDnD binaries and handles the low-level Tcl/Tk integration so you can use drag-and-drop in standard Tkinter code or integrate it into frameworks like PySimpleGUI and CustomTkinter that manage their own Tk root windows.

The core workflow is straightforward: create a TkinterDnD.Tk() root (or call TkinterDnD.require() on an existing root), register widgets as drop targets using drop_target_register(), and bind a handler with dnd_bind() to process the dropped data. The package handles the quirk that dropped file paths arrive as a Tcl list string (with braces around paths containing spaces) rather than a Python list, providing a splitlist() utility to parse them correctly.

Use it for:

  • Build a file picker UI where users drag files onto a listbox or input field instead of using a file dialog.
  • Create a batch file processor that accepts dropped files and queues them for processing.
  • Integrate drag-and-drop into a PySimpleGUI or CustomTkinter application without replacing the framework's root window.
  • Add native drag-and-drop to a cross-platform desktop tool that must work on Windows, macOS, and Linux.
  • Enable drag-and-drop in a Tkinter-based data entry form to accept dropped documents or images.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Adds native drag-and-drop support to Tkinter applications on Windows, macOS, and Unix by wrapping the tkDnD Tk extension.

Yes, if you need native drag-and-drop in a Tkinter application and are willing to work with a Pre-Alpha package. The low install friction, permissive license, active maintenance, and zero known vulnerabilities make it a reasonable choice. The main caveat is the Pre-Alpha status—test thoroughly in your target environments before shipping, and verify that the bundled tkDnD binaries work on all platforms you support.

Install

tkinterdnd2 on PyPI

pip

pip install tkinterdnd2

uv

uv add tkinterdnd2

poetry

poetry add tkinterdnd2

Installing tkinterdnd2

Before you install

Low install friction; pure Python wheel with no compiled dependencies to build. Actively maintained as of 2026-07-05 with recent release history.

License in practice

MIT license permits commercial and private use with minimal restrictions; permissive treatment means you can use this in proprietary projects.

Quickstart

pip install tkinterdnd2

import tkinter as tk
from tkinterdnd2 import DND_FILES, TkinterDnD

root = TkinterDnD.Tk()
lb = tk.Listbox(root)
lb.drop_target_register(DND_FILES)
lb.dnd_bind('<>', lambda e: lb.insert(tk.END, root.tk.splitlist(e.data)[0]))
lb.pack()
root.mainloop()

Requires Python 3.6 or later; tkDnD binaries are bundled but platform-specific behavior depends on native Tk/Tcl support on your OS.

Verify before relying

  • Whether tkDnD binaries are included for all three platforms (Windows, macOS, Unix) or if some require separate installation.
  • Compatibility with Python 3.12+ given the Pre-Alpha development status and Tcl 9 support claim.
  • Performance characteristics when handling large file drops or rapid drag-drop sequences.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 40 days since the last release
Last repo commit
First released
Downloads 273,913/month — #8,195 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tkinterdnd2-0.6.2-py3-none-any.whl

Development Status :: 2 - Pre-AlphaLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3

Tags

tkinter drag and dropnative dnd support tkinterfile drop tkintertkdnd python wrapperdrag drop gui tkintercross-platform tkinter dnd
gui-toolkitdrag-droptkinter

More Application Frameworks packages