根据QT5官方样例修改为PyQt5版本. if__name__=='__main__': app=QApplication(sys.argv) win=MainWindow() win.show() sys.exit(app.exec_()) classMainWindow(QtWidgets.QMainWindow,Ui_MainWindow): """docstringforMainWindow""" def__init__(self): super(MainWindow,self