打开文件目录选择一个文件夹
def setPicPath(self):
path=self.load_last_path()
file=QDialog()
fname,ftype=QFileDialog.getOpenFileName(file,'open',path)
print(fname)
if fname:
res = self.save_last_path(fname)
if res == 0:
print('false occured in path saving processing')
如果要获取地址或者别的可以试试下面这些函数

getOpenFileNames 获取多个文件的地址,返回的是一个数组
getOpenFileUrl 返回PyQt5.QtCore.QUrl 对象,不知道什么用途
网友评论