Reputation: 134
Alright. I play the game FRHD. I and a friend have a picture-to-track script. Right now, in order to select a file, I have to edit the actual script and type in my file name. I know that I can use an input to get the filename through the CLI, but I want to know if there is a way to open the File Explorer and select a certain file type there. Right now I am using this code:
from tkinter import Tk
from tkinter.filedialog import askopenfilename
Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
filename = askopenfilename() # show an "Open" dialog box and return the path to the selected file
print(filename)
What I want to know is if there is any way to only show .jpg files. Thanks, and as always, any help is greatly appreciated!
- ThePurpleBuccaneer
Upvotes: 0
Views: 1624
Reputation: 993
import subprocess
subprocess.Popen(r'explorer /select,"C:\path\of\folder\file"')
Upvotes: 1