python自动化web测试-pyqt中QFileDialog的使用

需求

需要在行编辑器中显示选择文件保存的路径
在这里插入图片描述

#导入控件
from PyQt5.QtWidgets import QFileDialog

#方法一:
self.reportLineEdit.setText('../logs/')

#方法二:
# 返回选中的文件夹路径
log_path= QFileDialog.getExistingDirectory()  
#reportLineEdit是行编辑器的属性名
self.reportLineEdit.setText(log_path)

猜你喜欢

转载自blog.csdn.net/qq_40904479/article/details/105778411