19 lines
476 B
Python
19 lines
476 B
Python
import tkinter as tk
|
|
from tkinterdnd2 import DND_FILES, TkinterDnD
|
|
|
|
window = TkinterDnD.Tk()
|
|
|
|
main_frame = tk.Frame(window, padx=50, pady=20)
|
|
main_frame.pack(fill=tk.BOTH, expand=True)
|
|
|
|
listbox = tk.Listbox(main_frame)
|
|
listbox.drop_target_register(DND_FILES)
|
|
listbox.dnd_bind('<<Drop>>', lambda x: listbox.insert(tk.END, x.data))
|
|
listbox.pack(fill=tk.BOTH, expand=True)
|
|
|
|
button = tk.Button(main_frame, text='Button')
|
|
button.pack(fill=tk.BOTH, expand=True)
|
|
|
|
window.mainloop()
|
|
|