[Tkinter-discuss] Text box reveal directory path?

Michael Lange klappnase at web.de
Fri Mar 2 21:23:53 CET 2012

Hi Jason,

Thus spoketh jason watkins <sofawatkins at hotmail.com> 
unto us on Thu, 1 Mar 2012 21:35:55 +0000:

> Is it possible to create a text box that will reveal the full path of a
> folder/file when that folder/file is dragged and dropped onto the text
> box?  I want it to function like terminal does on a Mac.  Thanks for
> any help, Jason 

Drag and drop with Tkinter is a little tricky. If you only need to handle
DnD within your application you can try the Tkdnd module from Python's
standard library.

However, te above sounds like you want to drag from an external program,
like a file manager?
In this case you need the tkdnd extension to Tk from 
http://sourceforge.net/projects/tkdnd/ and the Python wrapper from
http://klappnase.bubble.org/TkinterDnD2/index.html .

With these your mileage may vary, on windows systems drags as well as
drops have been reported to work, on unix systems only drops are
supported and I myself have never managed to get it decently working at
all, however some people reported success on linux and OSX too.



.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

	"Life and death are seldom logical."
	"But attaining a desired goal always is."
		-- McCoy and Spock, "The Galileo Seven", stardate 2821.7

More information about the Tkinter-discuss mailing list