import sys from PyQt5.QtWidgets import * from PyQt5 import uic from PyQt5 import QtCore from MainWindow import Ui_MainWindow from MyUi import MyWindow if __name__ == "__main__": #QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) app.setStyleSheet(""" /* 全局样式 */ * { font-family: 'Microsoft YaHei'; } /* 透明背景的特定标签样式 */ QLabel#label_8, QLabel#label_11, QLabel#label_13, QLabel#label_20, QLabel#label_21, QLabel#label_22, QLabel#label_23 { background-color: transparent; } QLabel#label_24, QLabel#label_16,QLabel#label_25,QLabel#label_26,QLabel#label_27,QLabel#label_15,QLabel#label_17 { background-color: transparent; } QLabel#label_18,QLabel#label_19,QLabel#PicBefore,QLabel#PicAfter{ background-color: transparent; } QLabel#class0,QLabel#class1,QLabel#class2,QLabel#class3,QLabel#Label_H,QLabel#Label_T,QLabel#Label_W,QLabel#Label_Type{ background-color: transparent; } QLabel#label_8, QLabel#label_11, QLabel#label_13, QLabel#label_20, QLabel#label_21, QLabel#label_22, QLabel#label_23,QLabel#label_24 { font-size: 18px; /* 可以根据需要调整字体大小 */ } /* 窗口背景样式 */ QWidget { background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop: 0.1 #c1dfc4, stop: 0.3 #deecdd, stop: 0.75 #deecdd stop: 0.9 #c1dfc4); } /* 按钮样式 */ QPushButton { background-color: #f2f9f2; color: #333333; border-radius: 10px; padding: 10px; border: 1px solid #CCCCCC; } /* 按钮悬停样式 */ QPushButton:hover { background-color: rgba(255, 255, 255, 0.2); } /* 按钮按下样式 */ QPushButton:pressed { background-color: rgba(255, 255, 255, 0.4); } /* 按钮禁用样式 */ QPushButton:disabled { background-color: transparent; color: #A0A0A0; border: 1px solid #E0E0E0; } """) MainWindow = QMainWindow() ui = Ui_MainWindow() My_Ui = MyWindow(ui) sys.exit(app.exec_())