Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag drop file onto Python script

I'm looking for a cross-platform way of making my Python script process a file's path by implementing a drag n drop method. At the moment I manually go to the terminal and use the sys.argv method:

python myscript.py /Python/myfile.xls

However this is slow and "techy". Ideally I would a quick and interactive way of allowing a file be processed by my Python script. I primarily need this to work for Mac but cross-platform would be better.

like image 940
Dan Avatar asked Feb 25 '26 04:02

Dan


1 Answers

If you want to use Tkinter, have a look at the Tkinter DnD binding from here http://klappnase.bubble.org/TkinterDnD/index.html

When run, the binding shows an example with a listbox that allows you to drag a file on to it.

like image 110
D K Avatar answered Feb 27 '26 17:02

D K