tkinterDnD
A nice and easy-to-use wrapper around the tkdnd package. No tcl installation, no build is required, just install and use it!
Install
The Pypi name is python-tkdnd, because tkinterDnD was already taken, but you can import the package as tkinterDnD
pip3 install python-tkdnd
or if you're using a distro like Windows 7, 10, or 11 replace pip3 with pip
Credits
Copyright (c) 2021 rdbende
Copyright (c) 2012-2020 Petasis - the tkdnd package
Copyright (c) 2020 Philippe Gagné - for Mac binaries
Copyright (c) 2017 Michael Lange - the TkinterDnD package
Little example
import tkinter as tk
from tkinter import ttk
import tkinterDnD # Importing the tkinterDnD module
# You have to use the tkinterDnD.Tk object for super easy initialization,
# and to be able to use the main window as a dnd widget
root = tkinterDnD.Tk()
root.title("tkinterDnD example")
stringvar = tk.StringVar()
stringvar.set('Drop here or drag from here!')
def drop(event):
# This function is called, when stuff is dropped into a widget
stringvar.set(event.data)
def drag_command(event):
# This function is called at the start of the drag,
# it returns the drag type, the content type, and the actual content
return (tkinterDnD.COPY, "DND_Text", "Some nice dropped text!")
# Without DnD hook you need to register the widget for every purpose,
# and bind it to the function you want to call
label_1 = tk.Label(root, textvar=stringvar, relief="solid")
label_1.pack(fill="both", expand=True, padx=10, pady=10)
label_1.register_drop_target("*")
label_1.bind("<<Drop>>", drop)
label_1.register_drag_source("*")
label_1.bind("<<DragInitCmd>>", drag_command)
# With DnD hook you just pass the command to the proper argument,
# and tkinterDnD will take care of the rest
# NOTE: You need a ttk widget to use these arguments
label_2 = ttk.Label(root, ondrop=drop, ondragstart=drag_command,
textvar=stringvar, padding=50, relief="solid")
label_2.pack(fill="both", expand=True, padx=10, pady=10)
root.mainloop()
Metadata
Release files for python-tkdnd 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-tkdnd-0.2.1.tar.gz | 157.9 kB | Without provenance | Details for python-tkdnd-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_tkdnd-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for python_tkdnd-0.2.1-py3-none-any.whl |
Total release size: 330.5 kB
Release files / python-tkdnd-0.2.1.tar.gz
| Download URL | python-tkdnd-0.2.1.tar.gz |
|---|---|
| Size | 157.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dbce480c1ab5923075aa6fa02e8ae85b984886dfaf20c82d20d78420ad19451b
|
|
BLAKE2b-256 checksum How to use checksums |
3abf06781b8ecdff505d021996fab9ebb8cc18606576f0ed34d0d6d75b337b6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
|
Release files / python_tkdnd-0.2.1-py3-none-any.whl
| Download URL | python_tkdnd-0.2.1-py3-none-any.whl |
|---|---|
| Size | 172.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e476f02c5a9f36361f494cb9e6bc4515790e224a22b4d14b8fbd90d7c1fc0e81
|
|
BLAKE2b-256 checksum How to use checksums |
952850130cd6667454c7c04100e8697e70c03428c8a672ba0f60601b6a6f1e02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
|
Security for python-tkdnd 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.