pyqt5中QFileDialog程序崩溃,跪求大神指导!!!

self.bt_located.clicked.connect(self.located)
按钮调用located函数
def located(self):
directory = QFileDialog.getExistingDirectory(self,"选取文件夹","C:/")
# self.lineEdit.setText(directory)
点击按钮后程序崩溃,显示python已停止工作

百思不得其解,跪求解决方法!!!

 

因为要传入的参数必须是widget,换成directory = QFileDialog.getExistingDirectory(self.centralwidget,"选取文件夹","C:/")

搜索