【发布时间】:2022-12-02 04:15:29
【问题描述】:
I am trying to create a gui in tkinter where I will have a Listbox and be able to drag and drop files into it. How can I store all the items inside this listbox in a list with a command on the button?
lb = tk.Listbox(root, height=8)
lb.drop_target_register(DND_FILES)
lb.dnd_bind("<<Drop>>", lambda e: lb.insert(tk.END, e.data))
lb.grid(row=1, column=0, sticky="ew")
btn = ttk.Button(root, text="Submit")
btn.grid(row=2,column=0)
【问题讨论】: