TkinterDnD2 is a python wrapper for George Petasis'' tkDnD Tk extension version 2
Project description
TkinterDnD2
Eliav2/tkinterdnd2 is a fork of the (unmaintained) pmgagne/tkinterdnd2 which is a python wrapper for tkdnd .
This repo was originally forked and edited for the purpose of publishing to pypi so one could simply install this package with pip install tkinterdnd2
.
This repository is being maintained to ensure availability of tkinterdnd2
into the future.
Install
python -m pip install tkinterdnd2
Usage
import tkinter as tk
from tkinterdnd2 import DND_FILES, TkinterDnD
root = TkinterDnD.Tk() # notice - use this instead of tk.Tk()
lb = tk.Listbox(root)
lb.insert(1, "drag files to here")
# register the listbox as a drop target
lb.drop_target_register(DND_FILES)
lb.dnd_bind('<<Drop>>', lambda e: lb.insert(tk.END, e.data))
lb.pack()
root.mainloop()
see any of the demos for usage examples.
tkinterdnd2
Tkinter native drag and drop support for windows, unix and Mac OSX.
What is TkinterDnD2
TkinterDnD2 is a python wrapper for George Petasis' tkDnD Tk extension version 2.
It is a domain public project.
What is TkDnD2
tkDnD2 is a tcl/Tk extension adding native drag and drop support.
What this repository is about
This repo package TkinterDnD2 and tkdnd2 into a standard python module.
When the extension is imported in python its location will be automatically added to the Tk search path.
This repository contains the compiled binaries from https://github.com/petasis/tkdnd/releases/tag/tkdnd-release-test-v2.9.4. In order to provide support on ARM, we include built binaries from the now defunct tkinterdnd2-universal which added ARM support.
pyinstaller
When using pyinstaller
, you should use the hook-tkinterdnd2.py file included to collect the TkDnD binaries and build them into the project. To use it, copy it into the base directory of your project, then run pyinstaller as follows:
pyinstaller -F -w myproject/myproject.py --additional-hooks-dir=.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tkinterdnd2-0.4.3.tar.gz
.
File metadata
- Download URL: tkinterdnd2-0.4.3.tar.gz
- Upload date:
- Size: 444.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
03a932a11b42ab139c4552b414aa10ee8a087b8386b52baca8c62939760c2ef2
|
|
MD5 |
99d26eff5a9761fcb3c1385832ad2109
|
|
BLAKE2b-256 |
6e2a9d50ee58c7a60bf0c8d4bd8030b4afc29c8bf60158f95dbc89e8081d29d2
|
File details
Details for the file tkinterdnd2-0.4.3-py3-none-any.whl
.
File metadata
- Download URL: tkinterdnd2-0.4.3-py3-none-any.whl
- Upload date:
- Size: 493.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
8804f5d2e2a99713ec93e85384397fec6bf66fdf2065e3750938d55018971c4a
|
|
MD5 |
7d3a733209a4a455d02cced8b05c291c
|
|
BLAKE2b-256 |
08c3e04f004a53c00dc01126b6f998264cef672c6883c36aa4bd65845a8eb4c0
|