#๐Ÿ”’ Access a file/get a file(specifically a folder)'s name when dragging it onto a script

8 messages ยท Page 1 of 1 (latest)

hasty plume
#

I'm trying to make a program that shifts the color of every image in a folder by dragging the folder on top of the script. I have everything else done, but I can't figure out how I go about getting the folder's name (for copying/pathing etc.). I've found a few stackoverflow posts about similar things (ie. sys.argv[1]), and I've found success in copying files such as images, but it none of these work with folders. Any ideas?

full plankBOT
#

@hasty plume

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

drifting crater
#

I would recommend just using tkinter.filedialog.askdirectory instead

https://docs.python.org/3/library/dialog.html

it can work without having an actual tkinter application

hasty plume
#

Will look into it, thanks!!!

#

Worked like a charm! Thanks a bunch

#

!close

full plankBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.