本文介绍了适用于Python的JFileChooser吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有类似于Java的JFileChooser
for Python?
I was wondering if there is something similar to Java's JFileChooser
for Python?
JFileChooser
是选择文件的图形前端.
JFileChooser
is a graphical front end to choose a file.
最好是Python已经具备的功能.也许和Tkinter在一起.
Preferably something that is already with Python. Maybe with Tkinter.
推荐答案
对于不需要wxPython并且坚持使用标准Python库的内容,可以使用tkFileDialog.askopenfilename()方法:
For something that doesn't require wxPython and sticks with the standard Python libs, you can use the tkFileDialog.askopenfilename() method:
#!/usr/bin/python
from Tkinter import *
from tkFileDialog import askopenfilename
root = Tk()
root.withdraw()
print askopenfilename()
这篇关于适用于Python的JFileChooser吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!