# -*- coding: utf-8 -*- import sys from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog,QApplication,QFileDialog from Ui_Hash_Gui import Ui_Dialog class Hash(QDialog, Ui_Dialog): def __init__(self, parent=None): super(Hash, self).__init__(parent) self.setupUi(self) @pyqtSlot() def on_open_btn_clicked(self): """ Slot documentation goes here. """ file = QFileDialog.getOpenFileName(self,"open file",'/') self.fileAddr_txt.setText(file) # TODO: not implemented yet #raise NotImplementedError if __name__ == '__main__': app = QApplication(sys.argv) dlg = Hash() dlg.show() sys.exit(app.exec_())
这个想让label显示打开文件的路径,可是选中文件后,一点打开,程序就退出了。
怎么回事?
..............