Hi,

I'm trying to implement a drag and drop feature in my Tkinter based gui.
I want to be able to drag a file from windows (explorer/desktop etc) into my 
program. Then i need my program to get the filepath for the file that was 
dropped.

I've tried to search all over the internet, in books and in the win32 
documentation provided with the win32 package but i keep finding conflicting 
information.

Furthest i have gotten is the following:

    _id = root.winfo_id()
    win32gui.DragAcceptFiles(_id, 1)

That works, without that i don't get the little 'drop' icon  when i drag 
something over, however after that i'm completly stuck, i've tried using 
win32gui.GetMessage() to see if there is anything in that output that relates 
to a drop,
I've tried win32api.DragQueryFile(_id).

I think i need to do something using a PyIDropTarget but i have no idea where 
to import that from, i've tried making a class with that as the name and then 
initializing it and passing it to pythoncom.RegisterDragDrop(_id, dropTarget)
dropTarget being the initialized PyIDropTarget class, however it says, it's not 
a com object...

I think i've just managed to get myself confused, i just need a pointer on the 
right way to do it, do i use registerdrag drop or do i use dragqueryfile and 
dragacceptfiles, and how to i check to see if my program has recieved a drop 
request, is there some sort of event or something i can listen for (thats 
initially what i thought GetMessage() was for but i'm unsure how to use it)

Any help would be much appreciated.
And if you need any more info don't hesitate to ask.

Thanks in advance
Alex

_________________________________________________________________
Search and win with BigSnapSearch.com 
http://www.bigsnapsearch.com
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to