from PyQt5 import QtWidgets, uic
from PyQt5.QtWidgets import QApplication
import sys
from PyQt5.QtWidgets import QFileDialog
from PyQt5.QtWidgets import QMessageBox, QTableWidgetItem
def selFileDlg(self):
filename, ftype = QFileDialog.getOpenFileName(self, '选择上传', 'C:\\', 'Excle文件(*.xlsx)')
# self.dataUserSelFile.setText(filename) # 其他控件可现实用户选择的文件名
# 如果用户未选择文件
if not os.path.isfile(filename):
QMessageBox.information(self, '提示', '未选择文件')
简单实现。