tkinterdnd2
TkinterDnD2 is a python wrapper for George Petasis'' tkDnD Tk extension version 2
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 tkinterdnd2uv
uv add tkinterdnd2poetry
poetry add tkinterdnd2Installing 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
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
customtkinterCustomTkinter wraps Python's Tkinter to provide…
permissive · top 5,000 on PyPI
pysimpleguiPySimpleGUI wraps tkinter and other GUI…
copyleft · top 15,000 on PyPI
sv-ttkApplies a modern, Windows 11-inspired visual…
permissive · top 15,000 on PyPI
ttkbootstrapApplies Bootstrap-inspired themes and a…
permissive · top 15,000 on PyPI
tkcalendarProvides Calendar and DateEntry widgets for…
copyleft · top 15,000 on PyPI
django-markdownxDjango MarkdownX provides a Markdown editor…
permissive · top 15,000 on PyPI
pyinstaller-hooks-contribProvides community-maintained hooks that extend…
unclear · top 5,000 on PyPI
seletoolsProvides helper functions for Selenium…
permissive · top 15,000 on PyPI
glfwPython bindings for GLFW 3 that wrap the C…
permissive · top 5,000 on PyPI
easyguiEasyGUI provides simple, non-event-driven GUI…
permissive · top 5,000 on PyPI