资源说明:根据QT5官方样例修改为PyQt5 版本.
if __name__ == '__main__':
app = QApplication(sys.argv)
win = MainWindow()
win.show()
sys.exit(app.exec_())
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
"""docstring for MainWindow"""
def __init__(self):
super(MainWindow, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.console = Console(self)
self.console.setEnabled(True)
self.setCentralWidget(self.console)
self.settings = SettingsDialog()
self.serial = QSerialPort()
self.status = QLabel()
self.ui.actionConnect.setEnabled(True)
self.ui.actionDisconnect.setEnabled(False)
self.ui.actionQuit.setEnabled(True)
self.ui.actionConfigure.setEnabled(True)
self.ui.statusBar.addWidget(self.status)
self.initActionsConnections()
self.serial.error.connect(self.handleError)
self.serial.readyRead.connect(self.readData)
self.console.getData.connect(self.writeData)
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。