Python Desktop Integration - Drag and drop
-
22-08-2019 - |
Question
I have a pygame window that I want to know when a file has been dragged and dropped onto it. I only need to be able to fetch the name of the file. How can this be accomplished?
Solution
Here's a forum thread that might be what you're looking for.
And another forum.
And a link to the msdn page. You'll probably want the pythoncom library.
OTHER TIPS
one option for a similar effect is is to use pygame's scrap module so you can copy-paste into the window, your program would just need to look for ctr-V events.
On this XFCE desktop I'm using If I hit ctrl-C with a file selected, the file name shows up when I type
pygame.scrap.init()
types= pygame.scrap.get_types()
print dict(
[type,pygame.scrap.get(type)]
for type intypes
)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow