I would like to use the simplest library to choose a file in local directories. My program has nothing to do with a fancy user interface. It can take all the input from the console. I don't want users to enter an entire path to the console. That's the only point I need a simple user interface. Can you suggest me a simple, cross platform python library for this purpose. Thanks in advance.
A:
Use the tkFileDialog module which is part of the standard installation.
import tkFileDialog
print tkFileDialog.askopenfilename()
PreludeAndFugue
2010-08-26 21:21:55
+11
A:
How about using Tkinter?
from Tkinter import Tk
from tkFileDialog 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)
Done!
Etaoin
2010-08-26 21:22:12
thank you very much
Mustafa Zengin
2010-08-26 21:27:28
A:
import easygui
print easygui.fileopenbox()
To install:
pip install http://easygui.sourceforge.net/download/version0.96/easygui_v0.96.zip
Demo:
import easygui
easygui.egdemo()
J.F. Sebastian
2010-08-26 21:37:23
+3
A:
Python 3.x version of Etaoin's answer for completeness:
from tkinter.filedialog import askopenfilename
filename = askopenfilename()
stefano palazzo
2010-08-26 21:43:40