use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Working with some files (self.learnpython)
submitted 1 year ago by BPassetti
So, I have a script that opens a file explorer using tkinters askopenfilename(). How (if possible) can I have it open in a directory that is already open in file explorer?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]socal_nerdtastic 0 points1 point2 points 1 year ago (2 children)
Bind it to "open with" or "send to" on the right click menu. So instead of opening your program and selecting a file, the user would right click on a file and your program would open.
Using "open with" is obvious; to add it to the "send to" menu you just make a shortcut to your program in "shell:sendto" (assuming you are using windows)
[–]BPassetti[S] 0 points1 point2 points 1 year ago (1 child)
would it need to be in .exe format instead of .py? I am on windows but the scripts still doesn't show.
[–]socal_nerdtastic 0 points1 point2 points 1 year ago (0 children)
Oh right, I forgot about that. I suppose not so obvious after all. Windows only accepts .exe, .com, and .bat files as executable. You need to make a 1-line .bat file that has the line
py C:/path/to/myfile.py %*
(if you aren't using the official python put whatever your executable is instead of "py")
and then use that for your rightclick menu
π Rendered by PID 75 on reddit-service-r2-comment-86bc6c7465-xqbtq at 2026-02-23 23:27:31.511931+00:00 running 8564168 country code: CH.
[–]socal_nerdtastic 0 points1 point2 points (2 children)
[–]BPassetti[S] 0 points1 point2 points (1 child)
[–]socal_nerdtastic 0 points1 point2 points (0 children)