I am using Tkinter for building a GUI for a python script. I need a button which opens up a dialog box which allows me to select both files and directories. Till now, I've come across
tkFileDialog.askdirectory(parent=root, title=dirtext1)
which allows just to select directories in the dialog box and,
tkFileDialog.askopenfilename(parent=root, title=filetext)
which allows me to just select files. As of now, I access these dialog boxes using separate buttons, each of which calls one of these functions. Is there anyway to select either a file or a folder using a single dialog box?