用qtdesiner 设计后经过pyuic 产生的文件代码
# Form implementation generated from reading ui file 'main_serve.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# 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(797, 523)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.widget = QtWidgets.QWidget(self.centralwidget)
self.widget.setGeometry(QtCore.QRect(10, 12, 769, 456))
self.widget.setObjectName("widget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.A = QtWidgets.QRadioButton(self.widget)
self.A.setObjectName("A")
self.horizontalLayout.addWidget(self.A)
self.B = QtWidgets.QRadioButton(self.widget)
self.B.setObjectName("B")
self.horizontalLayout.addWidget(self.B)
self.D = QtWidgets.QRadioButton(self.widget)
self.D.setObjectName("D")
self.horizontalLayout.addWidget(self.D)
self.C = QtWidgets.QRadioButton(self.widget)
self.C.setObjectName("C")
self.horizontalLayout.addWidget(self.C)
self.E = QtWidgets.QRadioButton(self.widget)
self.E.setObjectName("E")
self.horizontalLayout.addWidget(self.E)
spacerItem = QtWidgets.QSpacerItem(368, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.stopButton = QtWidgets.QPushButton(self.widget)
self.stopButton.setStyleSheet(" color: #fff;\n"
" background-color: #ed4014;\n"
" border-color: #ed4014;")
self.stopButton.setObjectName("stopButton")
self.horizontalLayout.addWidget(self.stopButton)
self.start = QtWidgets.QPushButton(self.widget)
self.start.setStyleSheet("color: #fff;\n"
" background-color: #19be6b;\n"
" border-color: #19be6b;")
self.start.setObjectName("start")
self.horizontalLayout.addWidget(self.start)
self.verticalLayout.addLayout(self.horizontalLayout)
self.tableWidget = QtWidgets.QTableWidget(self.widget)
self.tableWidget.setShowGrid(True)
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setColumnCount(5)
self.tableWidget.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(4, item)
self.tableWidget.horizontalHeader().setVisible(True)
self.tableWidget.horizontalHeader().setCascadingSectionResizes(False)
self.verticalLayout.addWidget(self.tableWidget)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
spacerItem1 = QtWidgets.QSpacerItem(588, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem1)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.delButton = QtWidgets.QPushButton(self.widget)
self.delButton.setLayoutDirection(QtCore.Qt.RightToLeft)
self.delButton.setStyleSheet(" color: #fff;\n"
" background-color: #ed4014;\n"
" border-color: #ed4014;")
self.delButton.setObjectName("delButton")
self.horizontalLayout_2.addWidget(self.delButton)
self.addButton = QtWidgets.QPushButton(self.widget)
self.addButton.setLayoutDirection(QtCore.Qt.RightToLeft)
self.addButton.setStyleSheet(" color: #fff;\n"
" background-color: #2d8cf0;\n"
" border-color: #2d8cf0;")
self.addButton.setObjectName("addButton")
self.horizontalLayout_2.addWidget(self.addButton)
self.horizontalLayout_3.addLayout(self.horizontalLayout_2)
self.verticalLayout.addLayout(self.horizontalLayout_3)
self.tableWidget_2 = QtWidgets.QTableWidget(self.widget)
self.tableWidget_2.setObjectName("tableWidget_2")
self.tableWidget_2.setColumnCount(1)
self.tableWidget_2.setRowCount(1)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setVerticalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
self.tableWidget_2.setItem(0, 0, item)
self.verticalLayout.addWidget(self.tableWidget_2)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
self.start.clicked.connect(MainWindow.startHandle)
self.delButton.clicked.connect(self.tableWidget.clearSelection)
self.addButton.clicked.connect(MainWindow.addAccount)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "主程序"))
self.A.setText(_translate("MainWindow", "A"))
self.B.setText(_translate("MainWindow", "B"))
self.D.setText(_translate("MainWindow", "D"))
self.C.setText(_translate("MainWindow", "C"))
self.E.setText(_translate("MainWindow", "E桌"))
self.stopButton.setText(_translate("MainWindow", "停止"))
self.start.setText(_translate("MainWindow", "开始"))
item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "可用"))
item = self.tableWidget.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "账号"))
item = self.tableWidget.horizontalHeaderItem(2)
item.setText(_translate("MainWindow", "密码"))
item = self.tableWidget.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "最小"))
item = self.tableWidget.horizontalHeaderItem(4)
item.setText(_translate("MainWindow", "最大"))
self.delButton.setText(_translate("MainWindow", "删除"))
self.addButton.setText(_translate("MainWindow", "新增"))
item = self.tableWidget_2.verticalHeaderItem(0)
item.setText(_translate("MainWindow", "1"))
item = self.tableWidget_2.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "12"))
__sortingEnabled = self.tableWidget_2.isSortingEnabled()
self.tableWidget_2.setSortingEnabled(False)
item = self.tableWidget_2.item(0, 0)
item.setText(_translate("MainWindow", "11"))
self.tableWidget_2.setSortingEnabled(__sortingEnabled)
效果
image.png
网友评论