叠层显示的时候,用于叠层显示的widget在qt designer中不要给layout,因为要在程序中给叠层layout
源码如下:
maingui
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'maingui.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1168, 837) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName("horizontalLayout") self.frame = QtWidgets.QFrame(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth()) self.frame.setSizePolicy(sizePolicy) self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") self.verticalLayout = QtWidgets.QVBoxLayout(self.frame) self.verticalLayout.setObjectName("verticalLayout") self.pushButton = QtWidgets.QPushButton(self.frame) self.pushButton.setObjectName("pushButton") self.verticalLayout.addWidget(self.pushButton) self.pushButton_2 = QtWidgets.QPushButton(self.frame) self.pushButton_2.setObjectName("pushButton_2") self.verticalLayout.addWidget(self.pushButton_2) self.pushButton_3 = QtWidgets.QPushButton(self.frame) self.pushButton_3.setObjectName("pushButton_3") self.verticalLayout.addWidget(self.pushButton_3) self.horizontalLayout.addWidget(self.frame) self.frame_2 = QtWidgets.QFrame(self.centralwidget) self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) self.frame_2.setObjectName("frame_2") self.horizontalLayout.addWidget(self.frame_2) MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "caiya")) self.pushButton.setText(_translate("MainWindow", "测试")) self.pushButton_2.setText(_translate("MainWindow", "手动")) self.pushButton_3.setText(_translate("MainWindow", "自动"))
handgui
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'handgui.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1127, 704) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_4.setObjectName("pushButton_4") self.gridLayout.addWidget(self.pushButton_4, 0, 2, 1, 1) self.pushButton_6 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_6.setObjectName("pushButton_6") self.gridLayout.addWidget(self.pushButton_6, 0, 4, 1, 1) self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setObjectName("pushButton_2") self.gridLayout.addWidget(self.pushButton_2, 0, 0, 1, 1) self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setObjectName("pushButton_3") self.gridLayout.addWidget(self.pushButton_3, 0, 1, 1, 1) self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_5.setObjectName("pushButton_5") self.gridLayout.addWidget(self.pushButton_5, 0, 3, 1, 1) self.pushButton_7 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_7.setObjectName("pushButton_7") self.gridLayout.addWidget(self.pushButton_7, 0, 5, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.line_2 = QtWidgets.QFrame(self.centralwidget) self.line_2.setFrameShape(QtWidgets.QFrame.HLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.verticalLayout.addWidget(self.line_2) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton_17 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_17.setObjectName("pushButton_17") self.horizontalLayout.addWidget(self.pushButton_17) self.pushButton_16 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_16.setObjectName("pushButton_16") self.horizontalLayout.addWidget(self.pushButton_16) self.line = QtWidgets.QFrame(self.centralwidget) self.line.setFrameShape(QtWidgets.QFrame.VLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.horizontalLayout.addWidget(self.line) self.pushButton_15 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_15.setObjectName("pushButton_15") self.horizontalLayout.addWidget(self.pushButton_15) self.pushButton_14 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_14.setObjectName("pushButton_14") self.horizontalLayout.addWidget(self.pushButton_14) self.pushButton_13 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_13.setObjectName("pushButton_13") self.horizontalLayout.addWidget(self.pushButton_13) self.pushButton_12 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_12.setObjectName("pushButton_12") self.horizontalLayout.addWidget(self.pushButton_12) self.pushButton_11 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_11.setObjectName("pushButton_11") self.horizontalLayout.addWidget(self.pushButton_11) self.pushButton_10 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_10.setObjectName("pushButton_10") self.horizontalLayout.addWidget(self.pushButton_10) self.pushButton_9 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_9.setObjectName("pushButton_9") self.horizontalLayout.addWidget(self.pushButton_9) self.pushButton_8 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_8.setObjectName("pushButton_8") self.horizontalLayout.addWidget(self.pushButton_8) self.verticalLayout.addLayout(self.horizontalLayout) self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.graphicsView.sizePolicy().hasHeightForWidth()) self.graphicsView.setSizePolicy(sizePolicy) self.graphicsView.setObjectName("graphicsView") self.verticalLayout.addWidget(self.graphicsView) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.pushButton_4.setText(_translate("MainWindow", "驱动电源")) self.pushButton_6.setText(_translate("MainWindow", "ZLAN6042-10")) self.pushButton_2.setText(_translate("MainWindow", "示波器")) self.pushButton_3.setText(_translate("MainWindow", "高压电源")) self.pushButton_5.setText(_translate("MainWindow", "ZLAN6042-5")) self.pushButton_7.setText(_translate("MainWindow", "双脉冲")) self.pushButton_17.setText(_translate("MainWindow", "高压电源")) self.pushButton_16.setText(_translate("MainWindow", "驱动电源")) self.pushButton_15.setText(_translate("MainWindow", "11")) self.pushButton_14.setText(_translate("MainWindow", "12")) self.pushButton_13.setText(_translate("MainWindow", "13")) self.pushButton_12.setText(_translate("MainWindow", "14")) self.pushButton_11.setText(_translate("MainWindow", "15")) self.pushButton_10.setText(_translate("MainWindow", "16")) self.pushButton_9.setText(_translate("MainWindow", "17")) self.pushButton_8.setText(_translate("MainWindow", "18"))
testgui
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'testgui.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1165, 769) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_25 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_25.setObjectName("verticalLayout_25") self.tabWidget = QtWidgets.QTabWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth()) self.tabWidget.setSizePolicy(sizePolicy) self.tabWidget.setObjectName("tabWidget") self.tab = QtWidgets.QWidget() self.tab.setObjectName("tab") self.verticalLayout_26 = QtWidgets.QVBoxLayout(self.tab) self.verticalLayout_26.setObjectName("verticalLayout_26") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.pushButton_2 = QtWidgets.QPushButton(self.tab) self.pushButton_2.setObjectName("pushButton_2") self.verticalLayout_2.addWidget(self.pushButton_2) self.checkBox = QtWidgets.QCheckBox(self.tab) self.checkBox.setObjectName("checkBox") self.verticalLayout_2.addWidget(self.checkBox) self.checkBox_2 = QtWidgets.QCheckBox(self.tab) self.checkBox_2.setObjectName("checkBox_2") self.verticalLayout_2.addWidget(self.checkBox_2) self.horizontalLayout.addLayout(self.verticalLayout_2) self.line = QtWidgets.QFrame(self.tab) self.line.setFrameShape(QtWidgets.QFrame.VLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.horizontalLayout.addWidget(self.line) self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.pushButton = QtWidgets.QPushButton(self.tab) self.pushButton.setObjectName("pushButton") self.verticalLayout_3.addWidget(self.pushButton) self.formLayout = QtWidgets.QFormLayout() self.formLayout.setObjectName("formLayout") self.checkBox_3 = QtWidgets.QCheckBox(self.tab) self.checkBox_3.setObjectName("checkBox_3") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.checkBox_3) self.checkBox_4 = QtWidgets.QCheckBox(self.tab) self.checkBox_4.setObjectName("checkBox_4") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.checkBox_4) self.checkBox_5 = QtWidgets.QCheckBox(self.tab) self.checkBox_5.setObjectName("checkBox_5") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.checkBox_5) self.checkBox_6 = QtWidgets.QCheckBox(self.tab) self.checkBox_6.setObjectName("checkBox_6") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.checkBox_6) self.verticalLayout_3.addLayout(self.formLayout) self.horizontalLayout.addLayout(self.verticalLayout_3) self.line_2 = QtWidgets.QFrame(self.tab) self.line_2.setFrameShape(QtWidgets.QFrame.VLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.horizontalLayout.addWidget(self.line_2) self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setObjectName("verticalLayout_4") self.gridLayout_3 = QtWidgets.QGridLayout() self.gridLayout_3.setObjectName("gridLayout_3") self.pushButton_3 = QtWidgets.QPushButton(self.tab) self.pushButton_3.setObjectName("pushButton_3") self.gridLayout_3.addWidget(self.pushButton_3, 1, 0, 1, 1) self.pushButton_4 = QtWidgets.QPushButton(self.tab) self.pushButton_4.setObjectName("pushButton_4") self.gridLayout_3.addWidget(self.pushButton_4, 0, 0, 1, 1) self.pushButton_5 = QtWidgets.QPushButton(self.tab) self.pushButton_5.setObjectName("pushButton_5") self.gridLayout_3.addWidget(self.pushButton_5, 0, 1, 1, 1) self.pushButton_6 = QtWidgets.QPushButton(self.tab) self.pushButton_6.setObjectName("pushButton_6") self.gridLayout_3.addWidget(self.pushButton_6, 1, 1, 1, 1) self.pushButton_7 = QtWidgets.QPushButton(self.tab) self.pushButton_7.setObjectName("pushButton_7") self.gridLayout_3.addWidget(self.pushButton_7, 0, 2, 1, 1) self.pushButton_8 = QtWidgets.QPushButton(self.tab) self.pushButton_8.setObjectName("pushButton_8") self.gridLayout_3.addWidget(self.pushButton_8, 1, 2, 1, 1) self.pushButton_9 = QtWidgets.QPushButton(self.tab) self.pushButton_9.setObjectName("pushButton_9") self.gridLayout_3.addWidget(self.pushButton_9, 0, 3, 1, 1) self.pushButton_10 = QtWidgets.QPushButton(self.tab) self.pushButton_10.setObjectName("pushButton_10") self.gridLayout_3.addWidget(self.pushButton_10, 1, 3, 1, 1) self.verticalLayout_4.addLayout(self.gridLayout_3) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.checkBox_10 = QtWidgets.QCheckBox(self.tab) self.checkBox_10.setObjectName("checkBox_10") self.horizontalLayout_2.addWidget(self.checkBox_10) self.checkBox_9 = QtWidgets.QCheckBox(self.tab) self.checkBox_9.setObjectName("checkBox_9") self.horizontalLayout_2.addWidget(self.checkBox_9) self.checkBox_11 = QtWidgets.QCheckBox(self.tab) self.checkBox_11.setObjectName("checkBox_11") self.horizontalLayout_2.addWidget(self.checkBox_11) self.checkBox_8 = QtWidgets.QCheckBox(self.tab) self.checkBox_8.setObjectName("checkBox_8") self.horizontalLayout_2.addWidget(self.checkBox_8) self.verticalLayout_4.addLayout(self.horizontalLayout_2) self.horizontalLayout.addLayout(self.verticalLayout_4) self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout_26.addLayout(self.verticalLayout) self.tabWidget.addTab(self.tab, "") self.tab_2 = QtWidgets.QWidget() self.tab_2.setObjectName("tab_2") self.gridLayout_4 = QtWidgets.QGridLayout(self.tab_2) self.gridLayout_4.setObjectName("gridLayout_4") self.verticalLayout_5 = QtWidgets.QVBoxLayout() self.verticalLayout_5.setObjectName("verticalLayout_5") self.verticalLayout_6 = QtWidgets.QVBoxLayout() self.verticalLayout_6.setObjectName("verticalLayout_6") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.verticalLayout_7 = QtWidgets.QVBoxLayout() self.verticalLayout_7.setObjectName("verticalLayout_7") self.pushButton_11 = QtWidgets.QPushButton(self.tab_2) self.pushButton_11.setObjectName("pushButton_11") self.verticalLayout_7.addWidget(self.pushButton_11) self.pushButton_13 = QtWidgets.QPushButton(self.tab_2) self.pushButton_13.setObjectName("pushButton_13") self.verticalLayout_7.addWidget(self.pushButton_13) self.pushButton_12 = QtWidgets.QPushButton(self.tab_2) self.pushButton_12.setObjectName("pushButton_12") self.verticalLayout_7.addWidget(self.pushButton_12) self.horizontalLayout_3.addLayout(self.verticalLayout_7) self.line_3 = QtWidgets.QFrame(self.tab_2) self.line_3.setFrameShape(QtWidgets.QFrame.VLine) self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_3.setObjectName("line_3") self.horizontalLayout_3.addWidget(self.line_3) self.verticalLayout_9 = QtWidgets.QVBoxLayout() self.verticalLayout_9.setObjectName("verticalLayout_9") self.formLayout_2 = QtWidgets.QFormLayout() self.formLayout_2.setObjectName("formLayout_2") self.label_2 = QtWidgets.QLabel(self.tab_2) self.label_2.setObjectName("label_2") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_2) self.label = QtWidgets.QLabel(self.tab_2) self.label.setObjectName("label") self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label) self.lineEdit = QtWidgets.QLineEdit(self.tab_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineEdit.sizePolicy().hasHeightForWidth()) self.lineEdit.setSizePolicy(sizePolicy) self.lineEdit.setObjectName("lineEdit") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.lineEdit) self.lineEdit_2 = QtWidgets.QLineEdit(self.tab_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineEdit_2.sizePolicy().hasHeightForWidth()) self.lineEdit_2.setSizePolicy(sizePolicy) self.lineEdit_2.setObjectName("lineEdit_2") self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.lineEdit_2) self.verticalLayout_9.addLayout(self.formLayout_2) self.pushButton_14 = QtWidgets.QPushButton(self.tab_2) self.pushButton_14.setObjectName("pushButton_14") self.verticalLayout_9.addWidget(self.pushButton_14) self.pushButton_17 = QtWidgets.QPushButton(self.tab_2) self.pushButton_17.setObjectName("pushButton_17") self.verticalLayout_9.addWidget(self.pushButton_17) self.horizontalLayout_3.addLayout(self.verticalLayout_9) self.line_4 = QtWidgets.QFrame(self.tab_2) self.line_4.setFrameShape(QtWidgets.QFrame.VLine) self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_4.setObjectName("line_4") self.horizontalLayout_3.addWidget(self.line_4) self.verticalLayout_8 = QtWidgets.QVBoxLayout() self.verticalLayout_8.setObjectName("verticalLayout_8") self.pushButton_16 = QtWidgets.QPushButton(self.tab_2) self.pushButton_16.setObjectName("pushButton_16") self.verticalLayout_8.addWidget(self.pushButton_16) self.pushButton_15 = QtWidgets.QPushButton(self.tab_2) self.pushButton_15.setObjectName("pushButton_15") self.verticalLayout_8.addWidget(self.pushButton_15) self.checkBox_7 = QtWidgets.QCheckBox(self.tab_2) self.checkBox_7.setObjectName("checkBox_7") self.verticalLayout_8.addWidget(self.checkBox_7) self.horizontalLayout_3.addLayout(self.verticalLayout_8) self.verticalLayout_6.addLayout(self.horizontalLayout_3) self.verticalLayout_5.addLayout(self.verticalLayout_6) self.gridLayout_4.addLayout(self.verticalLayout_5, 0, 0, 1, 1) self.tabWidget.addTab(self.tab_2, "") self.tab_3 = QtWidgets.QWidget() self.tab_3.setObjectName("tab_3") self.gridLayout = QtWidgets.QGridLayout(self.tab_3) self.gridLayout.setObjectName("gridLayout") self.verticalLayout_19 = QtWidgets.QVBoxLayout() self.verticalLayout_19.setObjectName("verticalLayout_19") self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.verticalLayout_22 = QtWidgets.QVBoxLayout() self.verticalLayout_22.setObjectName("verticalLayout_22") self.pushButton_35 = QtWidgets.QPushButton(self.tab_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pushButton_35.sizePolicy().hasHeightForWidth()) self.pushButton_35.setSizePolicy(sizePolicy) self.pushButton_35.setObjectName("pushButton_35") self.verticalLayout_22.addWidget(self.pushButton_35) self.verticalLayout_24 = QtWidgets.QVBoxLayout() self.verticalLayout_24.setObjectName("verticalLayout_24") self.checkBox_24 = QtWidgets.QCheckBox(self.tab_3) self.checkBox_24.setObjectName("checkBox_24") self.verticalLayout_24.addWidget(self.checkBox_24) self.checkBox_23 = QtWidgets.QCheckBox(self.tab_3) self.checkBox_23.setObjectName("checkBox_23") self.verticalLayout_24.addWidget(self.checkBox_23) self.verticalLayout_22.addLayout(self.verticalLayout_24) self.horizontalLayout_8.addLayout(self.verticalLayout_22) self.line_9 = QtWidgets.QFrame(self.tab_3) self.line_9.setFrameShape(QtWidgets.QFrame.VLine) self.line_9.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_9.setObjectName("line_9") self.horizontalLayout_8.addWidget(self.line_9) self.verticalLayout_21 = QtWidgets.QVBoxLayout() self.verticalLayout_21.setObjectName("verticalLayout_21") self.pushButton_36 = QtWidgets.QPushButton(self.tab_3) self.pushButton_36.setObjectName("pushButton_36") self.verticalLayout_21.addWidget(self.pushButton_36) self.formLayout_5 = QtWidgets.QFormLayout() self.formLayout_5.setObjectName("formLayout_5") self.checkBox_25 = QtWidgets.QCheckBox(self.tab_3) self.checkBox_25.setObjectName("checkBox_25") self.formLayout_5.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.checkBox_25) self.checkBox_26 = QtWidgets.QCheckBox(self.tab_3) self.checkBox_26.setObjectName("checkBox_26") self.formLayout_5.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.checkBox_26) self.checkBox_27 = QtWidgets.QCheckBox(self.tab_3) self.checkBox_27.setObjectName("checkBox_27") self.formLayout_5.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.checkBox_27) self.checkBox_28 = QtWidgets.QCheckBox(self.tab_3) self.checkBox_28.setObjectName("checkBox_28") self.formLayout_5.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.checkBox_28) self.verticalLayout_21.addLayout(self.formLayout_5) self.horizontalLayout_8.addLayout(self.verticalLayout_21) self.line_10 = QtWidgets.QFrame(self.tab_3) self.line_10.setFrameShape(QtWidgets.QFrame.VLine) self.line_10.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_10.setObjectName("line_10") self.horizontalLayout_8.addWidget(self.line_10) self.verticalLayout_20 = QtWidgets.QVBoxLayout() self.verticalLayout_20.setObjectName("verticalLayout_20") self.gridLayout_8 = QtWidgets.QGridLayout() self.gridLayout_8.setObjectName("gridLayout_8") self.pushButton_40 = QtWidgets.QPushButton(self.tab_3) self.pushButton_40.setObjectName("pushButton_40") self.gridLayout_8.addWidget(self.pushButton_40, 0, 1, 1, 1) self.pushButton_39 = QtWidgets.QPushButton(self.tab_3) self.pushButton_39.setObjectName("pushButton_39") self.gridLayout_8.addWidget(self.pushButton_39, 1, 0, 1, 1) self.pushButton_41 = QtWidgets.QPushButton(self.tab_3) self.pushButton_41.setObjectName("pushButton_41") self.gridLayout_8.addWidget(self.pushButton_41, 0, 2, 1, 1) self.pushButton_38 = QtWidgets.QPushButton(self.tab_3) self.pushButton_38.setObjectName("pushButton_38") self.gridLayout_8.addWidget(self.pushButton_38, 0, 0, 1, 1) self.pushButton_42 = QtWidgets.QPushButton(self.tab_3) self.pushButton_42.setObjectName("pushButton_42") self.gridLayout_8.addWidget(self.pushButton_42, 0, 3, 1, 1) self.pushButton_43 = QtWidgets.QPushButton(self.tab_3) self.pushButton_43.setObjectName("pushButton_43") self.gridLayout_8.addWidget(self.pushButton_43, 1, 1, 1, 1) self.pushButton_44 = QtWidgets.QPushButton(self.tab_3) self.pushButton_44.setObjectName("pushButton_44") self.gridLayout_8.addWidget(self.pushButton_44, 1, 2, 1, 1) self.pushButton_45 = QtWidgets.QPushButton(self.tab_3) self.pushButton_45.setObjectName("pushButton_45") self.gridLayout_8.addWidget(self.pushButton_45, 1, 3, 1, 1) self.verticalLayout_20.addLayout(self.gridLayout_8) self.horizontalLayout_9 = QtWidgets.QHBoxLayout() self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.checkBox_29 = QtWidgets.QCheckBox(self.tab_3) self.checkBox_29.setObjectName("checkBox_29") self.horizontalLayout_9.addWidget(self.checkBox_29) self.checkBox_31 = QtWidgets.QCheckBox(self.tab_3) self.checkBox_31.setObjectName("checkBox_31") self.horizontalLayout_9.addWidget(self.checkBox_31) self.checkBox_32 = QtWidgets.QCheckBox(self.tab_3) self.checkBox_32.setObjectName("checkBox_32") self.horizontalLayout_9.addWidget(self.checkBox_32) self.checkBox_30 = QtWidgets.QCheckBox(self.tab_3) self.checkBox_30.setObjectName("checkBox_30") self.horizontalLayout_9.addWidget(self.checkBox_30) self.verticalLayout_20.addLayout(self.horizontalLayout_9) self.horizontalLayout_8.addLayout(self.verticalLayout_20) self.verticalLayout_19.addLayout(self.horizontalLayout_8) self.gridLayout.addLayout(self.verticalLayout_19, 0, 0, 1, 1) self.tabWidget.addTab(self.tab_3, "") self.verticalLayout_25.addWidget(self.tabWidget) self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget) self.textBrowser.setObjectName("textBrowser") self.verticalLayout_25.addWidget(self.textBrowser) MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.pushButton_2.setText(_translate("MainWindow", "查询AI状态")) self.checkBox.setText(_translate("MainWindow", "AI1")) self.checkBox_2.setText(_translate("MainWindow", "AI2")) self.pushButton.setText(_translate("MainWindow", "查询DI状态")) self.checkBox_3.setText(_translate("MainWindow", "DI1")) self.checkBox_4.setText(_translate("MainWindow", "DI2")) self.checkBox_5.setText(_translate("MainWindow", "DI3")) self.checkBox_6.setText(_translate("MainWindow", "DI4")) self.pushButton_3.setText(_translate("MainWindow", "RL1关")) self.pushButton_4.setText(_translate("MainWindow", "RL1开")) self.pushButton_5.setText(_translate("MainWindow", "RL2开")) self.pushButton_6.setText(_translate("MainWindow", "RL2关")) self.pushButton_7.setText(_translate("MainWindow", "RL3开")) self.pushButton_8.setText(_translate("MainWindow", "RL3关")) self.pushButton_9.setText(_translate("MainWindow", "RL4开")) self.pushButton_10.setText(_translate("MainWindow", "RL4关")) self.checkBox_10.setText(_translate("MainWindow", "RL1")) self.checkBox_9.setText(_translate("MainWindow", "RL2")) self.checkBox_11.setText(_translate("MainWindow", "RL3")) self.checkBox_8.setText(_translate("MainWindow", "RL4")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "ZLAN6042-5")) self.pushButton_11.setText(_translate("MainWindow", "read V")) self.pushButton_13.setText(_translate("MainWindow", "read I")) self.pushButton_12.setText(_translate("MainWindow", "read state")) self.label_2.setText(_translate("MainWindow", "U/V")) self.label.setText(_translate("MainWindow", "I/A")) self.pushButton_14.setText(_translate("MainWindow", "设定电压电流")) self.pushButton_17.setText(_translate("MainWindow", "读设定电压电流")) self.pushButton_16.setText(_translate("MainWindow", "设备运行")) self.pushButton_15.setText(_translate("MainWindow", "停止控制")) self.checkBox_7.setText(_translate("MainWindow", "状态")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "AIYS_HV10")) self.pushButton_35.setText(_translate("MainWindow", "查询AI状态")) self.checkBox_24.setText(_translate("MainWindow", "AI1")) self.checkBox_23.setText(_translate("MainWindow", "AI2")) self.pushButton_36.setText(_translate("MainWindow", "查询DI状态")) self.checkBox_25.setText(_translate("MainWindow", "DI1")) self.checkBox_26.setText(_translate("MainWindow", "DI3")) self.checkBox_27.setText(_translate("MainWindow", "DI4")) self.checkBox_28.setText(_translate("MainWindow", "DI2")) self.pushButton_40.setText(_translate("MainWindow", "RL2开")) self.pushButton_39.setText(_translate("MainWindow", "RL1关")) self.pushButton_41.setText(_translate("MainWindow", "RL3开")) self.pushButton_38.setText(_translate("MainWindow", "RL1开")) self.pushButton_42.setText(_translate("MainWindow", "RL4开")) self.pushButton_43.setText(_translate("MainWindow", "RL1关")) self.pushButton_44.setText(_translate("MainWindow", "RL1关")) self.pushButton_45.setText(_translate("MainWindow", "RL1关")) self.checkBox_29.setText(_translate("MainWindow", "RL1")) self.checkBox_31.setText(_translate("MainWindow", "RL2")) self.checkBox_32.setText(_translate("MainWindow", "RL3")) self.checkBox_30.setText(_translate("MainWindow", "RL4")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "ZLAN6042-10"))
HVGUI
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'HVGUI.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(368, 194) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_2.setObjectName("lineEdit_2") self.gridLayout.addWidget(self.lineEdit_2, 0, 1, 1, 1) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.lineEdit = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit.setObjectName("lineEdit") self.gridLayout.addWidget(self.lineEdit, 1, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setObjectName("pushButton") self.verticalLayout.addWidget(self.pushButton) self.line = QtWidgets.QFrame(self.centralwidget) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.verticalLayout.addWidget(self.line) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout.addWidget(self.pushButton_2) self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setObjectName("pushButton_3") self.horizontalLayout.addWidget(self.pushButton_3) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem) self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_4.setObjectName("pushButton_4") self.horizontalLayout_2.addWidget(self.pushButton_4) self.verticalLayout.addLayout(self.horizontalLayout_2) self.verticalLayout_2.addLayout(self.verticalLayout) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "高压电源")) self.label_2.setText(_translate("MainWindow", "电流/A")) self.label.setText(_translate("MainWindow", "电压/V")) self.pushButton.setText(_translate("MainWindow", "设置电压")) self.pushButton_2.setText(_translate("MainWindow", "启动")) self.pushButton_3.setText(_translate("MainWindow", "停止")) self.pushButton_4.setText(_translate("MainWindow", "退出"))
tkgui
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'tkgui.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 324) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 2, 1, 1) self.label_4 = QtWidgets.QLabel(self.centralwidget) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 1, 2, 1, 1) self.comboBox = QtWidgets.QComboBox(self.centralwidget) self.comboBox.setObjectName("comboBox") self.gridLayout.addWidget(self.comboBox, 0, 3, 1, 1) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.lineEdit = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit.setObjectName("lineEdit") self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1) self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_3.setObjectName("lineEdit_3") self.gridLayout.addWidget(self.lineEdit_3, 1, 1, 1, 1) self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_4.setObjectName("lineEdit_4") self.gridLayout.addWidget(self.lineEdit_4, 1, 3, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.line = QtWidgets.QFrame(self.centralwidget) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.verticalLayout.addWidget(self.line) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.gridLayout_2 = QtWidgets.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_6.setObjectName("lineEdit_6") self.gridLayout_2.addWidget(self.lineEdit_6, 1, 2, 1, 1) self.label_5 = QtWidgets.QLabel(self.centralwidget) self.label_5.setObjectName("label_5") self.gridLayout_2.addWidget(self.label_5, 1, 0, 1, 1) self.label_7 = QtWidgets.QLabel(self.centralwidget) self.label_7.setObjectName("label_7") self.gridLayout_2.addWidget(self.label_7, 2, 0, 1, 1) self.label_10 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth()) self.label_10.setSizePolicy(sizePolicy) self.label_10.setAlignment(QtCore.Qt.AlignCenter) self.label_10.setObjectName("label_10") self.gridLayout_2.addWidget(self.label_10, 0, 1, 1, 1) self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_7.setObjectName("lineEdit_7") self.gridLayout_2.addWidget(self.lineEdit_7, 1, 3, 1, 1) self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_8.setObjectName("lineEdit_8") self.gridLayout_2.addWidget(self.lineEdit_8, 1, 4, 1, 1) self.lineEdit_10 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_10.setObjectName("lineEdit_10") self.gridLayout_2.addWidget(self.lineEdit_10, 2, 3, 1, 1) self.comboBox_3 = QtWidgets.QComboBox(self.centralwidget) self.comboBox_3.setObjectName("comboBox_3") self.gridLayout_2.addWidget(self.comboBox_3, 3, 2, 1, 1) self.lineEdit_9 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_9.setObjectName("lineEdit_9") self.gridLayout_2.addWidget(self.lineEdit_9, 2, 2, 1, 1) self.label_11 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_11.sizePolicy().hasHeightForWidth()) self.label_11.setSizePolicy(sizePolicy) self.label_11.setObjectName("label_11") self.gridLayout_2.addWidget(self.label_11, 0, 3, 1, 1) self.lineEdit_11 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_11.setObjectName("lineEdit_11") self.gridLayout_2.addWidget(self.lineEdit_11, 2, 4, 1, 1) self.comboBox_4 = QtWidgets.QComboBox(self.centralwidget) self.comboBox_4.setObjectName("comboBox_4") self.gridLayout_2.addWidget(self.comboBox_4, 3, 3, 1, 1) self.comboBox_5 = QtWidgets.QComboBox(self.centralwidget) self.comboBox_5.setObjectName("comboBox_5") self.gridLayout_2.addWidget(self.comboBox_5, 3, 4, 1, 1) self.label_12 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_12.sizePolicy().hasHeightForWidth()) self.label_12.setSizePolicy(sizePolicy) self.label_12.setObjectName("label_12") self.gridLayout_2.addWidget(self.label_12, 0, 4, 1, 1) self.label_9 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_9.sizePolicy().hasHeightForWidth()) self.label_9.setSizePolicy(sizePolicy) self.label_9.setObjectName("label_9") self.gridLayout_2.addWidget(self.label_9, 0, 2, 1, 1) self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_2.setObjectName("lineEdit_2") self.gridLayout_2.addWidget(self.lineEdit_2, 1, 1, 1, 1) self.label_8 = QtWidgets.QLabel(self.centralwidget) self.label_8.setObjectName("label_8") self.gridLayout_2.addWidget(self.label_8, 3, 0, 1, 1) self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_5.setObjectName("lineEdit_5") self.gridLayout_2.addWidget(self.lineEdit_5, 2, 1, 1, 1) self.comboBox_2 = QtWidgets.QComboBox(self.centralwidget) self.comboBox_2.setObjectName("comboBox_2") self.gridLayout_2.addWidget(self.comboBox_2, 3, 1, 1, 1) self.label_13 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_13.sizePolicy().hasHeightForWidth()) self.label_13.setSizePolicy(sizePolicy) self.label_13.setObjectName("label_13") self.gridLayout_2.addWidget(self.label_13, 4, 0, 1, 1) self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setText("") self.pushButton_2.setObjectName("pushButton_2") self.gridLayout_2.addWidget(self.pushButton_2, 4, 1, 1, 1) self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setText("") self.pushButton_3.setObjectName("pushButton_3") self.gridLayout_2.addWidget(self.pushButton_3, 4, 2, 1, 1) self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_4.setText("") self.pushButton_4.setObjectName("pushButton_4") self.gridLayout_2.addWidget(self.pushButton_4, 4, 3, 1, 1) self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_5.setText("") self.pushButton_5.setObjectName("pushButton_5") self.gridLayout_2.addWidget(self.pushButton_5, 4, 4, 1, 1) self.horizontalLayout.addLayout(self.gridLayout_2) self.verticalLayout.addLayout(self.horizontalLayout) self.line_3 = QtWidgets.QFrame(self.centralwidget) self.line_3.setFrameShape(QtWidgets.QFrame.HLine) self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_3.setObjectName("line_3") self.verticalLayout.addWidget(self.line_3) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.pushButton_6 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_6.setObjectName("pushButton_6") self.horizontalLayout_2.addWidget(self.pushButton_6) self.line_2 = QtWidgets.QFrame(self.centralwidget) self.line_2.setFrameShape(QtWidgets.QFrame.VLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.horizontalLayout_2.addWidget(self.line_2) self.pushButton_7 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_7.setObjectName("pushButton_7") self.horizontalLayout_2.addWidget(self.pushButton_7) self.pushButton_8 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_8.setObjectName("pushButton_8") self.horizontalLayout_2.addWidget(self.pushButton_8) self.pushButton_9 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_9.setObjectName("pushButton_9") self.horizontalLayout_2.addWidget(self.pushButton_9) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.pushButton = QtWidgets.QPushButton(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth()) self.pushButton.setSizePolicy(sizePolicy) self.pushButton.setObjectName("pushButton") self.horizontalLayout_3.addWidget(self.pushButton) self.verticalLayout.addLayout(self.horizontalLayout_3) self.verticalLayout_2.addLayout(self.verticalLayout) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "示波器")) self.label_3.setText(_translate("MainWindow", "触发通道")) self.label_4.setText(_translate("MainWindow", "触发电平/v")) self.label.setText(_translate("MainWindow", "水平位置[5,-5]")) self.label_2.setText(_translate("MainWindow", "水平scale/us")) self.label_5.setText(_translate("MainWindow", "scale/v")) self.label_7.setText(_translate("MainWindow", "position")) self.label_10.setText(_translate("MainWindow", "通道1")) self.label_11.setText(_translate("MainWindow", "通道3")) self.label_12.setText(_translate("MainWindow", "通道4")) self.label_9.setText(_translate("MainWindow", "通道2")) self.label_8.setText(_translate("MainWindow", "porbe")) self.label_13.setText(_translate("MainWindow", "使能通道")) self.pushButton_6.setText(_translate("MainWindow", "初始化")) self.pushButton_7.setText(_translate("MainWindow", "开启一次触发")) self.pushButton_8.setText(_translate("MainWindow", "获取数据")) self.pushButton_9.setText(_translate("MainWindow", "获取波形")) self.pushButton.setText(_translate("MainWindow", "关闭窗口"))
lvgui
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'lvgui.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(356, 216) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label_5 = QtWidgets.QLabel(self.centralwidget) self.label_5.setObjectName("label_5") self.gridLayout.addWidget(self.label_5, 1, 0, 1, 1) self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 0, 2, 1, 1) self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 3, 1, 1) self.label_6 = QtWidgets.QLabel(self.centralwidget) self.label_6.setObjectName("label_6") self.gridLayout.addWidget(self.label_6, 2, 0, 1, 1) self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_5.setObjectName("lineEdit_5") self.gridLayout.addWidget(self.lineEdit_5, 2, 2, 1, 1) self.lineEdit = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit.setObjectName("lineEdit") self.gridLayout.addWidget(self.lineEdit, 1, 1, 1, 1) self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_2.setObjectName("lineEdit_2") self.gridLayout.addWidget(self.lineEdit_2, 1, 2, 1, 1) self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_4.setObjectName("lineEdit_4") self.gridLayout.addWidget(self.lineEdit_4, 2, 1, 1, 1) self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_6.setObjectName("lineEdit_6") self.gridLayout.addWidget(self.lineEdit_6, 2, 3, 1, 1) self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_3.setObjectName("lineEdit_3") self.gridLayout.addWidget(self.lineEdit_3, 1, 3, 1, 1) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setObjectName("pushButton") self.verticalLayout.addWidget(self.pushButton) self.line = QtWidgets.QFrame(self.centralwidget) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.verticalLayout.addWidget(self.line) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setObjectName("pushButton_3") self.horizontalLayout.addWidget(self.pushButton_3) self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout.addWidget(self.pushButton_2) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem) self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_4.setObjectName("pushButton_4") self.horizontalLayout_2.addWidget(self.pushButton_4) self.verticalLayout.addLayout(self.horizontalLayout_2) self.verticalLayout_2.addLayout(self.verticalLayout) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "驱动电源")) self.label_5.setText(_translate("MainWindow", "电压/V")) self.label_2.setText(_translate("MainWindow", "ch2")) self.label_3.setText(_translate("MainWindow", "ch3")) self.label_6.setText(_translate("MainWindow", "电流/A")) self.label.setText(_translate("MainWindow", "ch1")) self.pushButton.setText(_translate("MainWindow", "设置电源")) self.pushButton_3.setText(_translate("MainWindow", "启动")) self.pushButton_2.setText(_translate("MainWindow", "停止")) self.pushButton_4.setText(_translate("MainWindow", "退出"))
ZLAN5GUI
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ZLAN5GUI.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(417, 109) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName("horizontalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 2, 1, 1) self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setText("") self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 1, 0, 1, 1) self.label_4 = QtWidgets.QLabel(self.centralwidget) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 0, 3, 1, 1) self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setText("") self.pushButton_2.setObjectName("pushButton_2") self.gridLayout.addWidget(self.pushButton_2, 1, 1, 1, 1) self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setText("") self.pushButton_3.setObjectName("pushButton_3") self.gridLayout.addWidget(self.pushButton_3, 1, 2, 1, 1) self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_4.setText("") self.pushButton_4.setObjectName("pushButton_4") self.gridLayout.addWidget(self.pushButton_4, 1, 3, 1, 1) self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 0, 1, 1, 1) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.gridLayout.addLayout(self.horizontalLayout_2, 2, 1, 1, 1) self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_5.setObjectName("pushButton_5") self.gridLayout.addWidget(self.pushButton_5, 2, 3, 1, 1) self.horizontalLayout.addLayout(self.gridLayout) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "ZLAN6042-5")) self.label.setText(_translate("MainWindow", "11")) self.label_3.setText(_translate("MainWindow", "13")) self.label_4.setText(_translate("MainWindow", "14")) self.label_2.setText(_translate("MainWindow", "12")) self.pushButton_5.setText(_translate("MainWindow", "退出"))
ZLAN10GUI
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ZLAN10GUI.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(417, 111) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName("horizontalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setText("") self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 1, 0, 1, 1) self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 0, 1, 1, 1) self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setText("") self.pushButton_3.setObjectName("pushButton_3") self.gridLayout.addWidget(self.pushButton_3, 1, 2, 1, 1) self.label_4 = QtWidgets.QLabel(self.centralwidget) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 0, 3, 1, 1) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 2, 1, 1) self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_4.setText("") self.pushButton_4.setObjectName("pushButton_4") self.gridLayout.addWidget(self.pushButton_4, 1, 3, 1, 1) self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setText("") self.pushButton_2.setObjectName("pushButton_2") self.gridLayout.addWidget(self.pushButton_2, 1, 1, 1, 1) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.gridLayout.addLayout(self.horizontalLayout_3, 2, 0, 1, 1) self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_5.setObjectName("pushButton_5") self.gridLayout.addWidget(self.pushButton_5, 2, 3, 1, 1) self.horizontalLayout.addLayout(self.gridLayout) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "ZLAN6042-10")) self.label_2.setText(_translate("MainWindow", "16")) self.label_4.setText(_translate("MainWindow", "18")) self.label.setText(_translate("MainWindow", "15")) self.label_3.setText(_translate("MainWindow", "17")) self.pushButton_5.setText(_translate("MainWindow", "退出"))
plgui
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'plgui.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(560, 151) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_2.setObjectName("lineEdit_2") self.gridLayout.addWidget(self.lineEdit_2, 1, 1, 1, 1) self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_3.setObjectName("lineEdit_3") self.gridLayout.addWidget(self.lineEdit_3, 1, 2, 1, 1) self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_4.setObjectName("lineEdit_4") self.gridLayout.addWidget(self.lineEdit_4, 1, 3, 1, 1) self.label_4 = QtWidgets.QLabel(self.centralwidget) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 0, 3, 1, 1) self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 0, 1, 1, 1) self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 2, 1, 1) self.lineEdit = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit.setObjectName("lineEdit") self.gridLayout.addWidget(self.lineEdit, 1, 0, 1, 1) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_5 = QtWidgets.QLabel(self.centralwidget) self.label_5.setObjectName("label_5") self.gridLayout.addWidget(self.label_5, 0, 4, 1, 1) self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_5.setObjectName("lineEdit_5") self.gridLayout.addWidget(self.lineEdit_5, 1, 4, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.line = QtWidgets.QFrame(self.centralwidget) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.verticalLayout.addWidget(self.line) self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setObjectName("pushButton") self.verticalLayout.addWidget(self.pushButton) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem) self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout_2.addWidget(self.pushButton_2) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout.addLayout(self.verticalLayout) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "双脉冲")) self.label_4.setText(_translate("MainWindow", "T2")) self.label_2.setText(_translate("MainWindow", "MS")) self.label_3.setText(_translate("MainWindow", "T1")) self.label.setText(_translate("MainWindow", "TM")) self.label_5.setText(_translate("MainWindow", "T3")) self.pushButton.setText(_translate("MainWindow", "发一次双脉冲")) self.pushButton_2.setText(_translate("MainWindow", "退出"))
主代码
from PyQt5 import QtWidgets from PyQt5 import QtGui from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QStackedLayout, QGraphicsPixmapItem import qtawesome import sys import os import maingui import handgui import testgui import HVGUI import tkgui import lvgui import ZLAN5GUI import ZLAN10GUI import plgui class my_mainwindow(): def __init__(self): # PyQt5中,每个应用程序都必须实例化一个QApplication(): app = QtWidgets.QApplication(sys.argv) my_MainWindow = MainWindow() self.my_ui = maingui.Ui_MainWindow() self.my_ui.setupUi(my_MainWindow) my_MainWindow1 = QtWidgets.QMainWindow() my_MainWindow2 = QtWidgets.QMainWindow() self.hv = QtWidgets.QMainWindow() self.tk = QtWidgets.QMainWindow() self.lv=QtWidgets.QMainWindow() self.Z5 = QtWidgets.QMainWindow() self.Z10 = QtWidgets.QMainWindow() self.pl = QtWidgets.QMainWindow() #################################################################### self.qsl=QStackedLayout(self.my_ui.frame_2) self.one=testgui.Ui_MainWindow() self.one.setupUi(my_MainWindow1) self.two=handgui.Ui_MainWindow() self.two.setupUi(my_MainWindow2) self.qsl.addWidget(my_MainWindow2) self.qsl.addWidget(my_MainWindow1) self.qsl.setCurrentIndex(1) self.two.pushButton_16.setStyleSheet("background-color: white") self.two.pushButton_16.setEnabled(0) self.two.pushButton_17.setStyleSheet("background-color: white") self.two.pushButton_17.setEnabled(0) self.two.pushButton_15.setStyleSheet("background-color: white") self.two.pushButton_15.setEnabled(0) self.two.pushButton_14.setStyleSheet("background-color: white") self.two.pushButton_14.setEnabled(0) self.two.pushButton_13.setStyleSheet("background-color: white") self.two.pushButton_13.setEnabled(0) self.two.pushButton_12.setStyleSheet("background-color: white") self.two.pushButton_12.setEnabled(0) self.two.pushButton_11.setStyleSheet("background-color: white") self.two.pushButton_11.setEnabled(0) self.two.pushButton_10.setStyleSheet("background-color: white") self.two.pushButton_10.setEnabled(0) self.two.pushButton_9.setStyleSheet("background-color: white") self.two.pushButton_9.setEnabled(0) self.two.pushButton_8.setStyleSheet("background-color: white") self.two.pushButton_8.setEnabled(0) ##############################################################高压电源 self.myhv=HVGUI.Ui_MainWindow() self.myhv.setupUi(self.hv) self.hv.setFixedSize(self.hv.width(),self.hv.height())#禁止缩放 self.hv.setWindowFlags(Qt.WindowMinimizeButtonHint)#禁止最大化按钮 self.myhv.lineEdit.setText('1') self.myhv.lineEdit_2.setText('500') ########################################################################示波器 self.mytk=tkgui.Ui_MainWindow() self.mytk.setupUi(self.tk) self.tk.setFixedSize(self.tk.width(), self.tk.height()) # 禁止缩放 self.tk.setWindowFlags(Qt.WindowMinimizeButtonHint) # 禁止最大化,关闭按钮 self.mytk.pushButton_2.setStyleSheet("background-color: green") self.mytk.pushButton_3.setStyleSheet("background-color: green") self.mytk.pushButton_4.setStyleSheet("background-color: green") self.mytk.pushButton_5.setStyleSheet("background-color: green") self.tkporbe=['1X','2X','5X','10X','20X','50X','100X','200X','500X','1000X','2000X','5000X'] self.tktrigger = ['1','2','3','4'] self.mytk.comboBox.addItems(self.tktrigger) self.mytk.comboBox_2.addItems(self.tkporbe) self.mytk.comboBox_3.addItems(self.tkporbe) self.mytk.comboBox_4.addItems(self.tkporbe) self.mytk.comboBox_5.addItems(self.tkporbe) self.mytk.lineEdit.setText('0') self.mytk.lineEdit_3.setText('20') self.mytk.lineEdit_4.setText('1') self.mytk.lineEdit_2.setText('5') self.mytk.lineEdit_6.setText('5') self.mytk.lineEdit_7.setText('5') self.mytk.lineEdit_8.setText('5') self.mytk.lineEdit_5.setText('0') self.mytk.lineEdit_9.setText('0') self.mytk.lineEdit_10.setText('0') self.mytk.lineEdit_11.setText('0') #############################################驱动电源 self.mylv=lvgui.Ui_MainWindow() self.mylv.setupUi(self.lv) self.lv.setFixedSize(self.lv.width(), self.lv.height()) # 禁止缩放 self.lv.setWindowFlags(Qt.WindowMinimizeButtonHint) # 禁止最大化按钮 self.mylv.lineEdit.setText('12') self.mylv.lineEdit_4.setText('2') self.mylv.lineEdit_2.setText('0') self.mylv.lineEdit_3.setText('0') self.mylv.lineEdit_5.setText('0') self.mylv.lineEdit_6.setText('0') ###############################################z5 self.myZ5= ZLAN5GUI.Ui_MainWindow() self.myZ5.setupUi(self.Z5) self.Z5.setFixedSize(self.Z5.width(), self.Z5.height()) # 禁止缩放 self.Z5.setWindowFlags(Qt.WindowMinimizeButtonHint) # 禁止最大化按钮 self.myZ5.pushButton.setStyleSheet("background-color: green") self.myZ5.pushButton_2.setStyleSheet("background-color: green") self.myZ5.pushButton_3.setStyleSheet("background-color: green") self.myZ5.pushButton_4.setStyleSheet("background-color: green") ####################################################Z10 self.myZ10 = ZLAN10GUI.Ui_MainWindow() self.myZ10.setupUi(self.Z10) self.Z10.setFixedSize(self.Z10.width(), self.Z10.height()) # 禁止缩放 self.Z10.setWindowFlags(Qt.WindowMinimizeButtonHint) # 禁止最大化按钮 self.myZ10.pushButton.setStyleSheet("background-color: green") self.myZ10.pushButton_2.setStyleSheet("background-color: green") self.myZ10.pushButton_3.setStyleSheet("background-color: green") self.myZ10.pushButton_4.setStyleSheet("background-color: green") ###############################################双脉冲 self.mypl = plgui.Ui_MainWindow() self.mypl.setupUi(self.pl) self.pl.setFixedSize(self.pl.width(), self.pl.height()) # 禁止缩放 self.pl.setWindowFlags(Qt.WindowMinimizeButtonHint) # 禁止最大化按钮 self.mypl.lineEdit.setText('1') self.mypl.lineEdit_2.setText('0') self.mypl.lineEdit_3.setText('20') self.mypl.lineEdit_4.setText('10') self.mypl.lineEdit_5.setText('10') ############################################################################## self.my_ui.pushButton.setIcon(qtawesome.icon('fa.legal',color='black')) self.my_ui.pushButton_2.setIcon(qtawesome.icon('fa.space-shuttle', color='black')) self.my_ui.pushButton_3.setIcon(qtawesome.icon('fa.american-sign-language-interpreting', color='black'))
#toolbar.setIconSize(QSize(36,36))
#####################################################################建立相关文件路径 mypath = os.path.exists(r".\test\waveform") if not mypath: os.makedirs(r".\test\waveform") mypath = os.path.exists(r".\test\data") if not mypath: os.makedirs(r".\test\data") # os.removedirs(r“c:\python”) #######################################################################测试 self.one.checkBox_10.setDisabled(1) self.one.checkBox_9.setDisabled(1) self.one.checkBox_11.setDisabled(1) self.one.checkBox_8.setDisabled(1) self.one.checkBox_7.setDisabled(1) self.one.checkBox_29.setDisabled(1) self.one.checkBox_30.setDisabled(1) self.one.checkBox_31.setDisabled(1) self.one.checkBox_32.setDisabled(1) self.one.tabWidget.currentChanged.connect(self.change) #################################################################### self.click_pushbutton() ##################################################################### my_MainWindow.show() sys.exit(app.exec_()) def click_pushbutton(self): self.my_ui.pushButton_2.clicked.connect(self.test) self.my_ui.pushButton.clicked.connect(self.hand) ####################################################test pushbutton self.mytk.pushButton.clicked.connect(self.myclose) self.mylv.pushButton_4.clicked.connect(self.lvguiclose) self.mypl.pushButton_2.clicked.connect(self.plguiclose) self.myhv.pushButton_4.clicked.connect(self.hvguiclose) self.myZ5.pushButton_5.clicked.connect(self.z5guiclose) self.myZ10.pushButton_5.clicked.connect(self.z10guiclose) ##########################################################hand pushbutton self.two.pushButton_3.clicked.connect(self.myhvgui) self.two.pushButton_2.clicked.connect(self.mytkgui) self.two.pushButton_4.clicked.connect(self.mylvgui) self.two.pushButton_5.clicked.connect(self.myz5gui) self.two.pushButton_6.clicked.connect(self.myz10gui) self.two.pushButton_7.clicked.connect(self.myplgui) def myclose(self): self.tk.close() def lvguiclose(self): self.lv.close() def plguiclose(self): self.pl.close() def hvguiclose(self): self.hv.close() def z5guiclose(self): self.Z5.close() def z10guiclose(self): self.Z10.close() ######################################hand window def myhvgui(self): self.hv.show() def mytkgui(self): self.tk.show() def mylvgui(self): self.lv.show() def myz5gui(self): self.Z5.show() def myz10gui(self): self.Z10.show() def myplgui(self): self.pl.show() ###########################################main window def test(self): self.qsl.setCurrentIndex(0) def hand(self): self.qsl.setCurrentIndex(1) def change(self): print('good') class MainWindow(QtWidgets.QMainWindow): """对QMainWindow类重写,实现一些功能""" def closeEvent(self, event): """重写该方法主要是解决打开子窗口时,如果关闭了主窗口但子窗口仍显示的问题, 使用sys.exit(0) 时就会只要关闭了主窗口,所有关联的子窗口也会全部关闭""" sys.exit(0) if __name__ == "__main__": my_mainwindow()
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'tkgui.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 324) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 2, 1, 1) self.label_4 = QtWidgets.QLabel(self.centralwidget) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 1, 2, 1, 1) self.comboBox = QtWidgets.QComboBox(self.centralwidget) self.comboBox.setObjectName("comboBox") self.gridLayout.addWidget(self.comboBox, 0, 3, 1, 1) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.lineEdit = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit.setObjectName("lineEdit") self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1) self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_3.setObjectName("lineEdit_3") self.gridLayout.addWidget(self.lineEdit_3, 1, 1, 1, 1) self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_4.setObjectName("lineEdit_4") self.gridLayout.addWidget(self.lineEdit_4, 1, 3, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.line = QtWidgets.QFrame(self.centralwidget) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.verticalLayout.addWidget(self.line) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.gridLayout_2 = QtWidgets.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_6.setObjectName("lineEdit_6") self.gridLayout_2.addWidget(self.lineEdit_6, 1, 2, 1, 1) self.label_5 = QtWidgets.QLabel(self.centralwidget) self.label_5.setObjectName("label_5") self.gridLayout_2.addWidget(self.label_5, 1, 0, 1, 1) self.label_7 = QtWidgets.QLabel(self.centralwidget) self.label_7.setObjectName("label_7") self.gridLayout_2.addWidget(self.label_7, 2, 0, 1, 1) self.label_10 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth()) self.label_10.setSizePolicy(sizePolicy) self.label_10.setAlignment(QtCore.Qt.AlignCenter) self.label_10.setObjectName("label_10") self.gridLayout_2.addWidget(self.label_10, 0, 1, 1, 1) self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_7.setObjectName("lineEdit_7") self.gridLayout_2.addWidget(self.lineEdit_7, 1, 3, 1, 1) self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_8.setObjectName("lineEdit_8") self.gridLayout_2.addWidget(self.lineEdit_8, 1, 4, 1, 1) self.lineEdit_10 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_10.setObjectName("lineEdit_10") self.gridLayout_2.addWidget(self.lineEdit_10, 2, 3, 1, 1) self.comboBox_3 = QtWidgets.QComboBox(self.centralwidget) self.comboBox_3.setObjectName("comboBox_3") self.gridLayout_2.addWidget(self.comboBox_3, 3, 2, 1, 1) self.lineEdit_9 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_9.setObjectName("lineEdit_9") self.gridLayout_2.addWidget(self.lineEdit_9, 2, 2, 1, 1) self.label_11 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_11.sizePolicy().hasHeightForWidth()) self.label_11.setSizePolicy(sizePolicy) self.label_11.setObjectName("label_11") self.gridLayout_2.addWidget(self.label_11, 0, 3, 1, 1) self.lineEdit_11 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_11.setObjectName("lineEdit_11") self.gridLayout_2.addWidget(self.lineEdit_11, 2, 4, 1, 1) self.comboBox_4 = QtWidgets.QComboBox(self.centralwidget) self.comboBox_4.setObjectName("comboBox_4") self.gridLayout_2.addWidget(self.comboBox_4, 3, 3, 1, 1) self.comboBox_5 = QtWidgets.QComboBox(self.centralwidget) self.comboBox_5.setObjectName("comboBox_5") self.gridLayout_2.addWidget(self.comboBox_5, 3, 4, 1, 1) self.label_12 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_12.sizePolicy().hasHeightForWidth()) self.label_12.setSizePolicy(sizePolicy) self.label_12.setObjectName("label_12") self.gridLayout_2.addWidget(self.label_12, 0, 4, 1, 1) self.label_9 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_9.sizePolicy().hasHeightForWidth()) self.label_9.setSizePolicy(sizePolicy) self.label_9.setObjectName("label_9") self.gridLayout_2.addWidget(self.label_9, 0, 2, 1, 1) self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_2.setObjectName("lineEdit_2") self.gridLayout_2.addWidget(self.lineEdit_2, 1, 1, 1, 1) self.label_8 = QtWidgets.QLabel(self.centralwidget) self.label_8.setObjectName("label_8") self.gridLayout_2.addWidget(self.label_8, 3, 0, 1, 1) self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_5.setObjectName("lineEdit_5") self.gridLayout_2.addWidget(self.lineEdit_5, 2, 1, 1, 1) self.comboBox_2 = QtWidgets.QComboBox(self.centralwidget) self.comboBox_2.setObjectName("comboBox_2") self.gridLayout_2.addWidget(self.comboBox_2, 3, 1, 1, 1) self.label_13 = QtWidgets.QLabel(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_13.sizePolicy().hasHeightForWidth()) self.label_13.setSizePolicy(sizePolicy) self.label_13.setObjectName("label_13") self.gridLayout_2.addWidget(self.label_13, 4, 0, 1, 1) self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setText("") self.pushButton_2.setObjectName("pushButton_2") self.gridLayout_2.addWidget(self.pushButton_2, 4, 1, 1, 1) self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_3.setText("") self.pushButton_3.setObjectName("pushButton_3") self.gridLayout_2.addWidget(self.pushButton_3, 4, 2, 1, 1) self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_4.setText("") self.pushButton_4.setObjectName("pushButton_4") self.gridLayout_2.addWidget(self.pushButton_4, 4, 3, 1, 1) self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_5.setText("") self.pushButton_5.setObjectName("pushButton_5") self.gridLayout_2.addWidget(self.pushButton_5, 4, 4, 1, 1) self.horizontalLayout.addLayout(self.gridLayout_2) self.verticalLayout.addLayout(self.horizontalLayout) self.line_3 = QtWidgets.QFrame(self.centralwidget) self.line_3.setFrameShape(QtWidgets.QFrame.HLine) self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_3.setObjectName("line_3") self.verticalLayout.addWidget(self.line_3) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.pushButton_6 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_6.setObjectName("pushButton_6") self.horizontalLayout_2.addWidget(self.pushButton_6) self.line_2 = QtWidgets.QFrame(self.centralwidget) self.line_2.setFrameShape(QtWidgets.QFrame.VLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.horizontalLayout_2.addWidget(self.line_2) self.pushButton_7 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_7.setObjectName("pushButton_7") self.horizontalLayout_2.addWidget(self.pushButton_7) self.pushButton_8 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_8.setObjectName("pushButton_8") self.horizontalLayout_2.addWidget(self.pushButton_8) self.pushButton_9 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_9.setObjectName("pushButton_9") self.horizontalLayout_2.addWidget(self.pushButton_9) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.pushButton = QtWidgets.QPushButton(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth()) self.pushButton.setSizePolicy(sizePolicy) self.pushButton.setObjectName("pushButton") self.horizontalLayout_3.addWidget(self.pushButton) self.verticalLayout.addLayout(self.horizontalLayout_3) self.verticalLayout_2.addLayout(self.verticalLayout) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "示波器")) self.label_3.setText(_translate("MainWindow", "触发通道")) self.label_4.setText(_translate("MainWindow", "触发电平/v")) self.label.setText(_translate("MainWindow", "水平位置[5,-5]")) self.label_2.setText(_translate("MainWindow", "水平scale/us")) self.label_5.setText(_translate("MainWindow", "scale/v")) self.label_7.setText(_translate("MainWindow", "position")) self.label_10.setText(_translate("MainWindow", "通道1")) self.label_11.setText(_translate("MainWindow", "通道3")) self.label_12.setText(_translate("MainWindow", "通道4")) self.label_9.setText(_translate("MainWindow", "通道2")) self.label_8.setText(_translate("MainWindow", "porbe")) self.label_13.setText(_translate("MainWindow", "使能通道")) self.pushButton_6.setText(_translate("MainWindow", "初始化")) self.pushButton_7.setText(_translate("MainWindow", "开启一次触发")) self.pushButton_8.setText(_translate("MainWindow", "获取数据")) self.pushButton_9.setText(_translate("MainWindow", "获取波形")) self.pushButton.setText(_translate("MainWindow", "关闭窗口"))