def readtxt(self):
global can_datas
filepath, filetype = systemset_improve.QtWidgets.QFileDialog.getOpenFileName(self, '选取附件', './', '*.txt')
if filepath == '':
self.message_manage('警告', '请选择一个数据文件!')
return
else:
self.lineEdit_4.setText(filepath) # 只读lineEdit用以显示附件路径
with open(filepath, "r", encoding="UTF-8") as file:
can_datas = file.read()
self.textEdit_10.setText(can_datas)
return can_datas
PyQt5中选取附件操作
最新推荐文章于 2024-10-31 20:45:30 发布