Easy Drag Files and Drop to Tkinter
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tkdragfiles-0.0.2.tar.gz
(6.4 kB
view hashes)
Built Distribution
Close
Hashes for tkdragfiles-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2521f859ff85c46699c721ce9442441eeb91548e4d2c62588b6365679c44be6 |
|
MD5 | 85d9cbe340f8d74e930c497478f06920 |
|
BLAKE2b-256 | b6f6d4e3a1a4ad302ea20483ef1d1f8a428b2420ab810216c12ea4054138db90 |