I am trying to add "drag and drop files" functionality into my python3.7 tkinter-based GUI. For that I use TkinterDnD. It works well when I run the app from my local IDE on Windows 10.
When I try to run the app from a docker (linux) container, the code runs without error, but the DND (from Windows file explorer to the app) does not work anymore. The DND seems to be refused by the root window.
Here is a sample of code that repoduces the DND mechanism:
import tkinter as tk
from TkinterDnD2 import *
def drop(event):
entry_sv.set(event.data)
root = TkinterDnD.Tk()
entry_sv = tk.StringVar()
entry = tk.Entry(root, textvar=entry_sv, width=80)
entry.pack(fill=tk.X)
entry.drop_target_register(DND_FILES)
entry.dnd_bind('<<Drop>>', drop)
root.mainloop()
To run the docker container before starting python :
docker run -it -v <my-files-dir-path> : <my-work-dir> <docker-image> bash
To install TkinterDND, I followed the following answer : How to Install and Use TkDnD with Python Tkinter on OSX?
Would you have an idea to fix that ?