Easy Drag Files and Drop to Tkinter
Only for windows
Installation
pip3 install tkdragfiles
pip3 install async_tkinter_loop #if u need asyncio
Easy to use
#for normal tk
import tkinter as tk
from tkdragfiles import start_dragfiles_event
root = tk.Tk()
root.geometry("600x200")
lb = tk.Listbox(root, height=500, width=500, selectmode=tk.SINGLE)
lb.pack()
def callback(file_paths):
for file_path in file_paths:
lb.insert("end", file_path)
start_dragfiles_event(root,callback)
root.mainloop()
#for asyncio tk
import tkinter as tk
from tkdragfiles import start_dragfiles_event
root = tk.Tk()
root.title("Drags file to me")
root.geometry("600x200")
lb = tk.Listbox(root, height=500, width=500, selectmode=tk.SINGLE)
lb.pack()
def callback(file_paths):
for file_path in file_paths:
lb.insert("end", file_path)
start_dragfiles_event(root,callback)
from async_tkinter_loop import async_handler, async_mainloop,get_event_loop,main_loop
loop = get_event_loop()
loop.run_until_complete(main_loop(root))
References
Metadata
Release files for tkdragfiles 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tkdragfiles-0.0.2.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tkdragfiles-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.9 kB
Release files / tkdragfiles-0.0.2.tar.gz
| Download URL | tkdragfiles-0.0.2.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8a15a2b0120ccf78173d8b2ee58d42a3a359076cafd744f862a869febddb9d2
|
|
BLAKE2b-256 checksum How to use checksums |
f1e37dab6728eae1de8102965c7cf5b207aec94fead43190b5b5ef77dbaf4cdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|
Release files / tkdragfiles-0.0.2-py3-none-any.whl
| Download URL | tkdragfiles-0.0.2-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2521f859ff85c46699c721ce9442441eeb91548e4d2c62588b6365679c44be6
|
|
BLAKE2b-256 checksum How to use checksums |
b6f6d4e3a1a4ad302ea20483ef1d1f8a428b2420ab810216c12ea4054138db90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|