[Python] 纯文本查看 复制代码
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.setStyleSheet("#MainWindow{border-image:url(./python.png;}")
MainWindow.resize(507, 120)
# 调整窗口在屏幕中央显示
center_pointer = QDesktopWidget().availableGeometry().center()
x = center_pointer.x()
y = center_pointer.y()
tl_x, tl_y, width, height = MainWindow.frameGeometry().getRect() # 窗口哦左上角坐标(x,y)、宽高(W, H)
MainWindow.move(3332, 0)
# 展示窗口
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy)
MainWindow.setStatusTip("")
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(0, 20, 31, 81))
self.label.setObjectName("label")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(90, 0, 31, 16))
self.label_2.setObjectName("label_2")
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(210, 0, 71, 16))
self.label_3.setObjectName("label_3")
self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setGeometry(QtCore.QRect(350, 0, 54, 12))
self.label_4.setObjectName("label_4")
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(40, 20, 91, 20))
self.lineEdit.setReadOnly(True)
self.lineEdit.setText(htys1[0])
self.lineEdit.setObjectName("lineEdit")
self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_2.setGeometry(QtCore.QRect(130, 20, 41, 20))
self.lineEdit_2.setReadOnly(True)
self.lineEdit_2.setObjectName("lineEdit_2")
self.lineEdit_2.setText(htsj1[0])
self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_3.setGeometry(QtCore.QRect(180, 20, 91, 20))
self.lineEdit_3.setReadOnly(True)
self.lineEdit_3.setObjectName("lineEdit_3")
self.lineEdit_3.setText(ljqzys1[0])
self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_4.setGeometry(QtCore.QRect(270, 20, 41, 20))
self.lineEdit_4.setReadOnly(True)
self.lineEdit_4.setObjectName("lineEdit_4")
self.lineEdit_4.setText(ljqzsj1[0])
self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_5.setGeometry(QtCore.QRect(320, 20, 91, 20))
self.lineEdit_5.setReadOnly(True)
self.lineEdit_5.setObjectName("lineEdit_5")
self.lineEdit_5.setText(ljhtys1[0])
self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_6.setGeometry(QtCore.QRect(410, 20, 41, 20))
self.lineEdit_6.setReadOnly(True)
self.lineEdit_6.setObjectName("lineEdit_6")
self.lineEdit_6.setText(ljhtsj1[0])
self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_7.setGeometry(QtCore.QRect(40, 50, 91, 20))
self.lineEdit_7.setReadOnly(True)
self.lineEdit_7.setObjectName("lineEdit_7")
self.lineEdit_7.setText(htys1[2])
self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_8.setGeometry(QtCore.QRect(130, 50, 41, 20))
self.lineEdit_8.setReadOnly(True)
self.lineEdit_8.setObjectName("lineEdit_8")
self.lineEdit_8.setText(htsj1[2])
self.lineEdit_9 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_9.setGeometry(QtCore.QRect(180, 50, 91, 20))
self.lineEdit_9.setReadOnly(True)
self.lineEdit_9.setObjectName("lineEdit_9")
self.lineEdit_9.setText(ljqzys1[2])
self.lineEdit_10 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_10.setGeometry(QtCore.QRect(320, 50, 91, 20))
self.lineEdit_10.setReadOnly(True)
self.lineEdit_10.setObjectName("lineEdit_10")
self.lineEdit_10.setText(ljhtys1[2])
self.lineEdit_11 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_11.setGeometry(QtCore.QRect(410, 50, 41, 20))
self.lineEdit_11.setReadOnly(True)
self.lineEdit_11.setObjectName("lineEdit_11")
self.lineEdit_11.setText(ljhtsj1[2])
self.lineEdit_12 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_12.setGeometry(QtCore.QRect(270, 50, 41, 20))
self.lineEdit_12.setReadOnly(True)
self.lineEdit_12.setObjectName("lineEdit_12")
self.lineEdit_12.setText(ljqzsj1[2])
self.lineEdit_13 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_13.setGeometry(QtCore.QRect(40, 80, 91, 20))
self.lineEdit_13.setReadOnly(True)
self.lineEdit_13.setObjectName("lineEdit_13")
self.lineEdit_13.setText(htys1[1])
self.lineEdit_14 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_14.setGeometry(QtCore.QRect(130, 80, 41, 20))
self.lineEdit_14.setReadOnly(True)
self.lineEdit_14.setObjectName("lineEdit_14")
self.lineEdit_14.setText(htsj1[1])
self.lineEdit_15 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_15.setGeometry(QtCore.QRect(180, 80, 91, 20))
self.lineEdit_15.setReadOnly(True)
self.lineEdit_15.setObjectName("lineEdit_15")
self.lineEdit_15.setText(ljqzys1[1])
self.lineEdit_16 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_16.setGeometry(QtCore.QRect(320, 80, 91, 20))
self.lineEdit_16.setReadOnly(True)
self.lineEdit_16.setObjectName("lineEdit_16")
self.lineEdit_16.setText(ljhtys1[1])
self.lineEdit_17 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_17.setGeometry(QtCore.QRect(410, 80, 41, 20))
self.lineEdit_17.setReadOnly(True)
self.lineEdit_17.setObjectName("lineEdit_17")
self.lineEdit_17.setText(ljhtsj1[1])
self.lineEdit_18 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_18.setGeometry(QtCore.QRect(270, 80, 41, 20))
self.lineEdit_18.setReadOnly(True)
self.lineEdit_18.setObjectName("lineEdit_18")
self.lineEdit_18.setText(ljqzsj1[1])
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 456, 23))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(460, 80, 31, 23))
self.pushButton.setObjectName("pushButton")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.label.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:12pt; color:#ff0000;\">1</span></p><p><span style=\" font-size:12pt; color:#ff0000;\">2</span></p><p><span style=\" font-size:12pt; color:#ff0000;\"></span></p></body>3</html>"))
self.label_2.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:10pt; color:#ff0000;\">4</span></p></body></html>"))
self.label_3.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:10pt; color:#ff0000;\">5</span></p></body></html>"))
self.label_4.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:10pt; color:#ff0000;\">6</span></p></body></html>"))
if __name__ == '__main__':
app = QApplication(sys.argv)
mainWindow = QMainWindow()
mainWindow.setAttribute(QtCore.Qt.WA_TranslucentBackground)
mainWindow.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool)
ui = Ui_MainWindow()
ui.setupUi(mainWindow)
mainWindow.show()
sys.exit(app.exec_())