PyQt - 如何打开目录文件夹? [英] PyQt - How to open a directory folder?

查看:109
本文介绍了PyQt - 如何打开目录文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了很多,我知道如何打开目录对话窗口.但我要找的是在windows操作系统下打开目录文件夹的方法,就像你右键单击本地文件夹之一并选择打开一样.

I have searched a lot and I know how to open a directory dialog window. But what I am looking for is the method to open a directory folder under windows OS, just like you right click one of your local folder and select open.

有什么建议吗?

推荐答案

试试这个:

dir_ = QtGui.QFileDialog.getExistingDirectory(None, 'Select a folder:', 'C:\\', QtGui.QFileDialog.ShowDirsOnly)

如果用户点击取消,则 dir_ 为空.

If the user hits cancel, then dir_ is empty.

这篇关于PyQt - 如何打开目录文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆