使用Python DirSelector打开文件 [英] Open file with Python DirSelector
问题描述
是否可以使用Python的DirSelector打开文件(而不是目录).也可以创建一个wx.FileSelector来打开一个目录.
is it somehow possible to open a file (instead of a directory) with Python's DirSelector. It's also fine to make a wx.FileSelector to open also a directory.
我只需要一个对话框即可打开文件和目录.
I just need one dialog window to open both, files and directories.
推荐答案
您可能可以使用wx.GenericDirCtrl,尽管它有点难看.还有一个纯python MultiDirDialog小部件,可以在wx.lib.agw.multidirdialog中找到.尽管它似乎不支持文件的显示和选择,但由于它是纯Python,因此您可以对其进行破解.
You might be able to use the wx.GenericDirCtrl for this, although it's a little ugly. There's also the pure python MultiDirDialog widget which can be found in wx.lib.agw.multidirdialog. While it doesn't appear to support the display and selection of files now, since it's pure Python, you can probably hack it.
这篇关于使用Python DirSelector打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!