how to have a directory dialog

ⅰ亾dé卋堺 提交于 2019-11-26 18:15:10

问题


In PyQt, how does one display a file browser that shows and selects only directories (not files)?

And how does one retrieve the name of the selected directory?


回答1:


From inside your QDialog/QWidget class, you should be able to do:

file = str(QFileDialog.getExistingDirectory(self, "Select Directory"))


来源:https://stackoverflow.com/questions/4286036/how-to-have-a-directory-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!