class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.label = MyLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(40, 49, 601, 288)) self.label.setObjectName("label") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) 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", "MainWindow")) self.label.setText(_translate("MainWindow", "TextLabel"))
class Ui_MainKdarts(object): def setupUi(self, MainKdarts): MainKdarts.setObjectName("MainKdarts") MainKdarts.resize(806, 616) self.centralwidget = QtGui.QWidget(MainKdarts) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_2 = QtGui.QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") #self.label = MyLabel(self.centralwidget) self.label = MyLabel() sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setMinimumSize(QtCore.QSize(400, 400)) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) self.frame = QtGui.QFrame(self.centralwidget) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Sunken) self.frame.setObjectName("frame") self.widget = QtGui.QWidget(self.frame) self.widget.setGeometry(QtCore.QRect(8, 8, 371, 33)) self.widget.setObjectName("widget") self.horizontalLayout_5 = QtGui.QHBoxLayout(self.widget) self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_2 = QtGui.QLabel(self.widget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setMinimumSize(QtCore.QSize(30, 0)) self.label_2.setObjectName("label_2") self.horizontalLayout_2.addWidget(self.label_2) self.lcdNumber = QtGui.QLCDNumber(self.widget) self.lcdNumber.setFrameShape(QtGui.QFrame.NoFrame) self.lcdNumber.setFrameShadow(QtGui.QFrame.Plain) self.lcdNumber.setProperty("intValue", QtCore.QVariant(501)) self.lcdNumber.setObjectName("lcdNumber") self.horizontalLayout_2.addWidget(self.lcdNumber) self.horizontalLayout_5.addLayout(self.horizontalLayout_2) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.label_3 = QtGui.QLabel(self.widget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_3.sizePolicy().hasHeightForWidth()) self.label_3.setSizePolicy(sizePolicy) self.label_3.setObjectName("label_3") self.horizontalLayout_3.addWidget(self.label_3) self.pushButton = QtGui.QPushButton(self.widget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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.horizontalLayout_5.addLayout(self.horizontalLayout_3) self.horizontalLayout.addWidget(self.frame) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem1) self.lineEdit = QtGui.QLineEdit(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit.sizePolicy().hasHeightForWidth()) self.lineEdit.setSizePolicy(sizePolicy) self.lineEdit.setMinimumSize(QtCore.QSize(700, 77)) font = QtGui.QFont() font.setPointSize(32) self.lineEdit.setFont(font) self.lineEdit.setAlignment(QtCore.Qt.AlignCenter) self.lineEdit.setObjectName("lineEdit") self.horizontalLayout_4.addWidget(self.lineEdit) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem2) self.verticalLayout.addLayout(self.horizontalLayout_4) self.verticalLayout_2.addLayout(self.verticalLayout) MainKdarts.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainKdarts) self.menubar.setGeometry(QtCore.QRect(0, 0, 806, 28)) self.menubar.setObjectName("menubar") MainKdarts.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainKdarts) self.statusbar.setObjectName("statusbar") MainKdarts.setStatusBar(self.statusbar) self.retranslateUi(MainKdarts) QtCore.QMetaObject.connectSlotsByName(MainKdarts) def retranslateUi(self, MainKdarts): MainKdarts.setWindowTitle( QtGui.QApplication.translate("MainKdarts", "KDarts", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText( QtGui.QApplication.translate("MainKdarts", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText( QtGui.QApplication.translate("MainKdarts", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText( QtGui.QApplication.translate("MainKdarts", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText( QtGui.QApplication.translate("MainKdarts", "Cancel", None, QtGui.QApplication.UnicodeUTF8)) self.lineEdit.setText( QtGui.QApplication.translate("MainKdarts", "matteo", None, QtGui.QApplication.UnicodeUTF8))
class Ui_Main(object): def setupUi(self, Main): Main.setObjectName("Main") Main.resize(910, 655) self.horizontalLayout_7 = QtWidgets.QHBoxLayout(Main) self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label_r00 = MyLabel(Main) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r00.setFont(font) self.label_r00.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r00.setAlignment(QtCore.Qt.AlignCenter) self.label_r00.setObjectName("label_r00") self.horizontalLayout.addWidget(self.label_r00) self.label_r01 = MyLabel(Main) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r01.setFont(font) self.label_r01.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r01.setTextFormat(QtCore.Qt.AutoText) self.label_r01.setAlignment(QtCore.Qt.AlignCenter) self.label_r01.setObjectName("label_r01") self.horizontalLayout.addWidget(self.label_r01) self.label_r02 = MyLabel(Main) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r02.setFont(font) self.label_r02.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r02.setTextFormat(QtCore.Qt.AutoText) self.label_r02.setAlignment(QtCore.Qt.AlignCenter) self.label_r02.setObjectName("label_r02") self.horizontalLayout.addWidget(self.label_r02) self.label_r03 = MyLabel(Main) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r03.setFont(font) self.label_r03.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r03.setTextFormat(QtCore.Qt.AutoText) self.label_r03.setAlignment(QtCore.Qt.AlignCenter) self.label_r03.setObjectName("label_r03") self.horizontalLayout.addWidget(self.label_r03) self.label_r04 = MyLabel(Main) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r04.setFont(font) self.label_r04.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r04.setTextFormat(QtCore.Qt.AutoText) self.label_r04.setAlignment(QtCore.Qt.AlignCenter) self.label_r04.setObjectName("label_r04") self.horizontalLayout.addWidget(self.label_r04) self.verticalLayout_3.addLayout(self.horizontalLayout) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.label_r11 = MyLabel(Main) self.label_r11.setMinimumSize(QtCore.QSize(0, 0)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r11.setFont(font) self.label_r11.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r11.setTextFormat(QtCore.Qt.AutoText) self.label_r11.setAlignment(QtCore.Qt.AlignCenter) self.label_r11.setObjectName("label_r11") self.verticalLayout_2.addWidget(self.label_r11) self.horizontalLayout_3.addLayout(self.verticalLayout_2) self.label = QtWidgets.QLabel(Main) self.label.setText("") self.label.setObjectName("label") self.horizontalLayout_3.addWidget(self.label) self.pushButton = QtWidgets.QPushButton(Main) self.pushButton.setMaximumSize(QtCore.QSize(500, 501)) self.pushButton.setBaseSize(QtCore.QSize(200, 200)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(42) self.pushButton.setFont(font) self.pushButton.setObjectName("pushButton") self.horizontalLayout_3.addWidget(self.pushButton) self.label_2 = QtWidgets.QLabel(Main) self.label_2.setText("") self.label_2.setObjectName("label_2") self.horizontalLayout_3.addWidget(self.label_2) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.label_r05 = MyLabel(Main) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r05.setFont(font) self.label_r05.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r05.setTextFormat(QtCore.Qt.AutoText) self.label_r05.setAlignment(QtCore.Qt.AlignCenter) self.label_r05.setObjectName("label_r05") self.verticalLayout.addWidget(self.label_r05) self.horizontalLayout_3.addLayout(self.verticalLayout) self.verticalLayout_3.addLayout(self.horizontalLayout_3) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_r10 = MyLabel(Main) self.label_r10.setMinimumSize(QtCore.QSize(0, 0)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r10.setFont(font) self.label_r10.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r10.setTextFormat(QtCore.Qt.AutoText) self.label_r10.setAlignment(QtCore.Qt.AlignCenter) self.label_r10.setObjectName("label_r10") self.horizontalLayout_2.addWidget(self.label_r10) self.label_r09 = MyLabel(Main) self.label_r09.setMinimumSize(QtCore.QSize(0, 0)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r09.setFont(font) self.label_r09.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r09.setTextFormat(QtCore.Qt.AutoText) self.label_r09.setAlignment(QtCore.Qt.AlignCenter) self.label_r09.setObjectName("label_r09") self.horizontalLayout_2.addWidget(self.label_r09) self.label_r08 = MyLabel(Main) self.label_r08.setMinimumSize(QtCore.QSize(0, 0)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r08.setFont(font) self.label_r08.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r08.setTextFormat(QtCore.Qt.AutoText) self.label_r08.setAlignment(QtCore.Qt.AlignCenter) self.label_r08.setObjectName("label_r08") self.horizontalLayout_2.addWidget(self.label_r08) self.label_r07 = MyLabel(Main) self.label_r07.setMinimumSize(QtCore.QSize(0, 0)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r07.setFont(font) self.label_r07.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r07.setTextFormat(QtCore.Qt.AutoText) self.label_r07.setAlignment(QtCore.Qt.AlignCenter) self.label_r07.setObjectName("label_r07") self.horizontalLayout_2.addWidget(self.label_r07) self.label_r06 = MyLabel(Main) self.label_r06.setMinimumSize(QtCore.QSize(0, 0)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(30) self.label_r06.setFont(font) self.label_r06.setStyleSheet("border:1px solid black;border-radius:5px") self.label_r06.setTextFormat(QtCore.Qt.AutoText) self.label_r06.setAlignment(QtCore.Qt.AlignCenter) self.label_r06.setObjectName("label_r06") self.horizontalLayout_2.addWidget(self.label_r06) self.verticalLayout_3.addLayout(self.horizontalLayout_2) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.label_p1 = QtWidgets.QLabel(Main) self.label_p1.setMaximumSize(QtCore.QSize(16777215, 40)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(16) self.label_p1.setFont(font) self.label_p1.setObjectName("label_p1") self.horizontalLayout_5.addWidget(self.label_p1) self.label_p2 = QtWidgets.QLabel(Main) self.label_p2.setMaximumSize(QtCore.QSize(16777215, 40)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(16) self.label_p2.setFont(font) self.label_p2.setObjectName("label_p2") self.horizontalLayout_5.addWidget(self.label_p2) self.label_p3 = QtWidgets.QLabel(Main) self.label_p3.setMaximumSize(QtCore.QSize(16777215, 40)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(16) self.label_p3.setFont(font) self.label_p3.setObjectName("label_p3") self.horizontalLayout_5.addWidget(self.label_p3) self.verticalLayout_3.addLayout(self.horizontalLayout_5) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.label_p4 = QtWidgets.QLabel(Main) self.label_p4.setMaximumSize(QtCore.QSize(16777215, 40)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(16) self.label_p4.setFont(font) self.label_p4.setObjectName("label_p4") self.horizontalLayout_4.addWidget(self.label_p4) self.label_p5 = QtWidgets.QLabel(Main) self.label_p5.setMaximumSize(QtCore.QSize(16777215, 40)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(16) self.label_p5.setFont(font) self.label_p5.setObjectName("label_p5") self.horizontalLayout_4.addWidget(self.label_p5) self.label_p6 = QtWidgets.QLabel(Main) self.label_p6.setMaximumSize(QtCore.QSize(16777215, 40)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(16) self.label_p6.setFont(font) self.label_p6.setObjectName("label_p6") self.horizontalLayout_4.addWidget(self.label_p6) self.verticalLayout_3.addLayout(self.horizontalLayout_4) self.horizontalLayout_6.addLayout(self.verticalLayout_3) self.textEdit = QtWidgets.QTextEdit(Main) self.textEdit.setMaximumSize(QtCore.QSize(350, 16777215)) font = QtGui.QFont() font.setFamily("仿宋") font.setPointSize(14) self.textEdit.setFont(font) self.textEdit.setObjectName("textEdit") self.horizontalLayout_6.addWidget(self.textEdit) self.horizontalLayout_7.addLayout(self.horizontalLayout_6) self.retranslateUi(Main) self.pushButton.clicked.connect(Main.lottery_start) self.label_r00.label_double_click.connect(Main.label_doubl_cleck) self.label_r01.label_double_click.connect(Main.label_doubl_cleck) self.label_r02.label_double_click.connect(Main.label_doubl_cleck) self.label_r08.label_double_click.connect(Main.label_doubl_cleck) self.label_r03.label_double_click.connect(Main.label_doubl_cleck) self.label_r05.label_double_click.connect(Main.label_doubl_cleck) self.label_r04.label_double_click.connect(Main.label_doubl_cleck) self.label_r06.label_double_click.connect(Main.label_doubl_cleck) self.label_r07.label_double_click.connect(Main.label_doubl_cleck) self.label_r08.label_double_click.connect(Main.label_doubl_cleck) self.label_r09.label_double_click.connect(Main.label_doubl_cleck) self.label_r10.label_double_click.connect(Main.label_doubl_cleck) self.label_r11.label_double_click.connect(Main.label_doubl_cleck) QtCore.QMetaObject.connectSlotsByName(Main) def retranslateUi(self, Main): _translate = QtCore.QCoreApplication.translate Main.setWindowTitle(_translate("Main", "Form")) self.label_r00.setText(_translate("Main", "三等奖")) self.label_r01.setText(_translate("Main", "幸运奖")) self.label_r02.setText(_translate("Main", "特等奖")) self.label_r03.setText(_translate("Main", "二等奖")) self.label_r04.setText(_translate("Main", "幸运奖")) self.label_r11.setText(_translate("Main", "四等奖")) self.pushButton.setText(_translate("Main", "点击抽奖")) self.label_r05.setText(_translate("Main", "一等奖")) self.label_r10.setText(_translate("Main", "四等奖")) self.label_r09.setText(_translate("Main", "四等奖")) self.label_r08.setText(_translate("Main", "四等奖")) self.label_r07.setText(_translate("Main", "四等奖")) self.label_r06.setText(_translate("Main", "四等奖")) self.label_p1.setText(_translate("Main", "特等奖:1")) self.label_p2.setText(_translate("Main", "一等奖:2")) self.label_p3.setText(_translate("Main", "三等奖:4")) self.label_p4.setText(_translate("Main", "四等奖:5")) self.label_p5.setText(_translate("Main", "五等奖:10")) self.label_p6.setText(_translate("Main", "幸运奖:5000"))
class Ui_MainKdarts(object): def setupUi(self, MainKdarts): MainKdarts.setObjectName("MainKdarts") MainKdarts.resize(806, 616) self.centralwidget = QtGui.QWidget(MainKdarts) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_2 = QtGui.QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") #self.label = MyLabel(self.centralwidget) self.label = MyLabel() sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setMinimumSize(QtCore.QSize(400, 400)) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) self.frame = QtGui.QFrame(self.centralwidget) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Sunken) self.frame.setObjectName("frame") self.widget = QtGui.QWidget(self.frame) self.widget.setGeometry(QtCore.QRect(8, 8, 371, 33)) self.widget.setObjectName("widget") self.horizontalLayout_5 = QtGui.QHBoxLayout(self.widget) self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_2 = QtGui.QLabel(self.widget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setMinimumSize(QtCore.QSize(30, 0)) self.label_2.setObjectName("label_2") self.horizontalLayout_2.addWidget(self.label_2) self.lcdNumber = QtGui.QLCDNumber(self.widget) self.lcdNumber.setFrameShape(QtGui.QFrame.NoFrame) self.lcdNumber.setFrameShadow(QtGui.QFrame.Plain) self.lcdNumber.setProperty("intValue", QtCore.QVariant(501)) self.lcdNumber.setObjectName("lcdNumber") self.horizontalLayout_2.addWidget(self.lcdNumber) self.horizontalLayout_5.addLayout(self.horizontalLayout_2) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.label_3 = QtGui.QLabel(self.widget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth()) self.label_3.setSizePolicy(sizePolicy) self.label_3.setObjectName("label_3") self.horizontalLayout_3.addWidget(self.label_3) self.pushButton = QtGui.QPushButton(self.widget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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.horizontalLayout_5.addLayout(self.horizontalLayout_3) self.horizontalLayout.addWidget(self.frame) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem1) self.lineEdit = QtGui.QLineEdit(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineEdit.sizePolicy().hasHeightForWidth()) self.lineEdit.setSizePolicy(sizePolicy) self.lineEdit.setMinimumSize(QtCore.QSize(700, 77)) font = QtGui.QFont() font.setPointSize(32) self.lineEdit.setFont(font) self.lineEdit.setAlignment(QtCore.Qt.AlignCenter) self.lineEdit.setObjectName("lineEdit") self.horizontalLayout_4.addWidget(self.lineEdit) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem2) self.verticalLayout.addLayout(self.horizontalLayout_4) self.verticalLayout_2.addLayout(self.verticalLayout) MainKdarts.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainKdarts) self.menubar.setGeometry(QtCore.QRect(0, 0, 806, 28)) self.menubar.setObjectName("menubar") MainKdarts.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainKdarts) self.statusbar.setObjectName("statusbar") MainKdarts.setStatusBar(self.statusbar) self.retranslateUi(MainKdarts) QtCore.QMetaObject.connectSlotsByName(MainKdarts) def retranslateUi(self, MainKdarts): MainKdarts.setWindowTitle(QtGui.QApplication.translate("MainKdarts", "KDarts", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText(QtGui.QApplication.translate("MainKdarts", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(QtGui.QApplication.translate("MainKdarts", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText(QtGui.QApplication.translate("MainKdarts", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText(QtGui.QApplication.translate("MainKdarts", "Cancel", None, QtGui.QApplication.UnicodeUTF8)) self.lineEdit.setText(QtGui.QApplication.translate("MainKdarts", "matteo", None, QtGui.QApplication.UnicodeUTF8))
class Ui_Tracker(object): def setupUi(self, Tracker): Tracker.setObjectName("Tracker") Tracker.setWindowModality(QtCore.Qt.NonModal) Tracker.resize(803, 644) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(170, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(212, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(85, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(113, 170, 170)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(170, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(212, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.PlaceholderText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(170, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(212, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(85, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(113, 170, 170)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(170, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(212, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.PlaceholderText, brush) brush = QtGui.QBrush(QtGui.QColor(85, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(170, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(212, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(85, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(113, 170, 170)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(85, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush) brush = QtGui.QBrush(QtGui.QColor(85, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(170, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(170, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush) brush = QtGui.QBrush(QtGui.QColor(170, 255, 255)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush) brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.PlaceholderText, brush) Tracker.setPalette(palette) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("1234.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) Tracker.setWindowIcon(icon) Tracker.setTabShape(QtWidgets.QTabWidget.Triangular) self.centralwidget = QtWidgets.QWidget(Tracker) self.centralwidget.setObjectName("centralwidget") self.btn_open = QtWidgets.QPushButton(self.centralwidget) self.btn_open.setGeometry(QtCore.QRect(30, 480, 90, 30)) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap("123.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btn_open.setIcon(icon1) self.btn_open.setObjectName("btn_open") self.btn_play = QtWidgets.QPushButton(self.centralwidget) self.btn_play.setGeometry(QtCore.QRect(220, 480, 90, 30)) self.btn_play.setIcon(icon1) self.btn_play.setObjectName("btn_play") self.btn_gray = QtWidgets.QPushButton(self.centralwidget) self.btn_gray.setGeometry(QtCore.QRect(650, 480, 90, 30)) self.btn_gray.setIcon(icon1) self.btn_gray.setObjectName("btn_gray") self.btn_cap = QtWidgets.QPushButton(self.centralwidget) self.btn_cap.setGeometry(QtCore.QRect(440, 480, 90, 30)) self.btn_cap.setIcon(icon1) self.btn_cap.setObjectName("btn_cap") self.wgt_video = MyLabel(self.centralwidget) self.wgt_video.setGeometry(QtCore.QRect(0, 80, 400, 340)) self.wgt_video.setLayoutDirection(QtCore.Qt.LeftToRight) self.wgt_video.setTextFormat(QtCore.Qt.AutoText) self.wgt_video.setAlignment(QtCore.Qt.AlignCenter) self.wgt_video.setIndent(-1) self.wgt_video.setObjectName("wgt_video") self.wgt_picture = MyLabel(self.centralwidget) self.wgt_picture.setGeometry(QtCore.QRect(400, 80, 401, 170)) self.wgt_picture.setAlignment(QtCore.Qt.AlignCenter) self.wgt_picture.setObjectName("wgt_picture") self.wgt_gray = MyLabel(self.centralwidget) self.wgt_gray.setGeometry(QtCore.QRect(400, 250, 401, 170)) self.wgt_gray.setAlignment(QtCore.Qt.AlignCenter) self.wgt_gray.setObjectName("wgt_gray") Tracker.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(Tracker) self.menubar.setGeometry(QtCore.QRect(0, 0, 803, 26)) self.menubar.setObjectName("menubar") self.menu = QtWidgets.QMenu(self.menubar) self.menu.setObjectName("menu") self.menu_2 = QtWidgets.QMenu(self.menubar) self.menu_2.setObjectName("menu_2") Tracker.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(Tracker) self.statusbar.setObjectName("statusbar") Tracker.setStatusBar(self.statusbar) self.action = QtWidgets.QAction(Tracker) self.action.setObjectName("action") self.action_2 = QtWidgets.QAction(Tracker) self.action_2.setObjectName("action_2") self.action_3 = QtWidgets.QAction(Tracker) self.action_3.setObjectName("action_3") self.menu.addAction(self.action_2) self.menu.addAction(self.action_3) self.menu_2.addAction(self.action) self.menubar.addAction(self.menu.menuAction()) self.menubar.addAction(self.menu_2.menuAction()) self.retranslateUi(Tracker) self.btn_open.clicked.connect(Tracker.btn_Open_Clicked) self.btn_play.clicked.connect(Tracker.btn_Play_Clicked) self.btn_cap.clicked.connect(Tracker.btn_Cap_Clicked) self.btn_gray.clicked.connect(Tracker.btn_Gray_Clicked) QtCore.QMetaObject.connectSlotsByName(Tracker) def retranslateUi(self, Tracker): _translate = QtCore.QCoreApplication.translate Tracker.setWindowTitle(_translate("Tracker", "MainWindow")) self.btn_open.setText(_translate("Tracker", "打开")) self.btn_play.setText(_translate("Tracker", "播放")) self.btn_gray.setText(_translate("Tracker", "灰度图")) self.btn_cap.setText(_translate("Tracker", "提取图片")) self.wgt_video.setText(_translate("Tracker", "视频")) self.wgt_picture.setText(_translate("Tracker", "图片")) self.wgt_gray.setText(_translate("Tracker", "灰度图")) self.menu.setTitle(_translate("Tracker", "菜单")) self.menu_2.setTitle(_translate("Tracker", "帮助")) self.action.setText(_translate("Tracker", "关于")) self.action_2.setText(_translate("Tracker", "开始")) self.action_3.setText(_translate("Tracker", "打开")) def paintEvent(self, event): painter = QPainter(self) painter.setBrush(Qt.green) painter.drawRect(self.rect()) pixmap = QPixmap("back.jpg") painter.drawPixmap(self.rect(), pixmap)
class Ui_window(object): def setupUi(self, window, width=300, height=300): self.window = window window.setObjectName("window") window.resize(width, height) window.setWindowFlags(Qt.FramelessWindowHint | Qt.Tool) window.setAttribute(Qt.WA_TranslucentBackground) self.centralwidget = QtWidgets.QWidget(window) self.centralwidget.setStyleSheet("QWidget#centralwidget {\n" "background: #90202020;\n" "border-style: inset;\n" "border-width: 1px;\n" "border-color: #a0404050;\n" "border-radius: 10px;}") self.centralwidget.setObjectName("centralwidget") if window.__class__.__base__.__name__ == 'QMainWindow': window.setCentralWidget(self.centralwidget) else: self.windowLayout = QtWidgets.QVBoxLayout(self.window) self.windowLayout.setContentsMargins(0, 0, 0, 0) self.windowLayout.setSpacing(0) self.windowLayout.setObjectName("windowLayout") self.windowLayout.addWidget(self.centralwidget) self.mainlayout = QtWidgets.QVBoxLayout(self.centralwidget) self.mainlayout.setContentsMargins(0, 0, 0, 0) self.mainlayout.setSpacing(0) self.mainlayout.setObjectName("mainlayout") self.wcontent = QtWidgets.QWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.wcontent.sizePolicy().hasHeightForWidth()) self.wcontent.setSizePolicy(sizePolicy) self.wcontent.setObjectName("wcontent") self.contentlayout = QtWidgets.QHBoxLayout(self.wcontent) self.contentlayout.setContentsMargins(0, 0, 0, 0) self.contentlayout.setSpacing(0) self.contentlayout.setObjectName("contentlayout") self.wcenter = QtWidgets.QWidget(self.wcontent) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.wcenter.sizePolicy().hasHeightForWidth()) self.wcenter.setSizePolicy(sizePolicy) self.wcenter.setMinimumSize(QtCore.QSize(1, 1)) self.wcenter.setObjectName("wcenter") self.centerLayout = QtWidgets.QVBoxLayout(self.wcenter) self.centerLayout.setContentsMargins(4, 0, 0, 0) self.centerLayout.setSpacing(0) self.centerLayout.setObjectName("centerLayout") self.ltitle = MyLabel(self.wcenter) self.ltitle.setAlignment(QtCore.Qt.AlignCenter) self.ltitle.setObjectName("ltitle") self.ltitle.onMouseMove.connect(self.ltitleMouseMove) self.ltitle.onMouseRelease.connect(self.ltitleMouseRelease) self.ltitle.onMousePress.connect(self.ltitleMousePress) self.ltitle.setStyleSheet('padding-top :6px') self.centerLayout.addWidget(self.ltitle) #self.graphicsView = QtWidgets.QGraphicsView(self.wcenter) #self.graphicsView.setObjectName("graphicsView") #self.centerLayout.addWidget(self.graphicsView) self.contentlayout.addWidget(self.wcenter) self.wrborder = MyWidget(self.wcontent) self.wrborder.onMouseMove.connect(self.wrborderMouseMove) self.wrborder.onMouseRelease.connect(self.wrborderMouseRelease) self.wrborder.onMousePress.connect(self.wrborderMousePress) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.wrborder.sizePolicy().hasHeightForWidth()) self.wrborder.setSizePolicy(sizePolicy) self.wrborder.setMinimumSize(QtCore.QSize(6, 0)) self.wrborder.setCursor(QtGui.QCursor(QtCore.Qt.SizeHorCursor)) self.wrborder.setStyleSheet("") self.wrborder.setObjectName("wrborder") self.contentlayout.addWidget(self.wrborder) self.mainlayout.addWidget(self.wcontent) self.wbottom = MyWidget(self.centralwidget) self.wbottom.setCursor(QtGui.QCursor(QtCore.Qt.SizeVerCursor)) self.wbottom.setMouseTracking(True) self.wbottom.setObjectName("wbottom") self.wbottom.onMouseMove.connect(self.wbottomMouseMove) self.wbottom.onMouseRelease.connect(self.wbottomMouseRelease) self.wbottom.onMousePress.connect(self.wbottomMousePress) self.bottomLayout = QtWidgets.QHBoxLayout(self.wbottom) self.bottomLayout.setContentsMargins(0, 0, 0, 0) self.bottomLayout.setSpacing(0) self.bottomLayout.setObjectName("bottomLayout") spacerItem = QtWidgets.QSpacerItem(471, 6, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.bottomLayout.addItem(spacerItem) self.lconner = MyLabel(self.wbottom) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lconner.sizePolicy().hasHeightForWidth()) self.lconner.setSizePolicy(sizePolicy) self.lconner.setMinimumSize(QtCore.QSize(6, 6)) self.lconner.setMaximumSize(QtCore.QSize(6, 6)) self.lconner.setCursor(QtGui.QCursor(QtCore.Qt.SizeFDiagCursor)) self.lconner.setMouseTracking(True) self.lconner.setText("") self.lconner.setObjectName("lconner") self.lconner.onMouseMove.connect(self.lconnerMouseMove) self.lconner.onMouseRelease.connect(self.lconnerMouseRelease) self.lconner.onMousePress.connect(self.lconnerMousePress) self.bottomLayout.addWidget(self.lconner) self.mainlayout.addWidget(self.wbottom) self.retranslateUi(window) QtCore.QMetaObject.connectSlotsByName(window) self.window.move(QApplication.desktop().screen().rect().center() - self.window.rect().center()) def onpress(self, event): print('on press') def wrborderMousePress(self, event): self.w = self.window.width() def wrborderMouseMove(self, event): w = event.globalX() - self.wrborder.mx + self.w g = self.window.geometry() g.setWidth(w) self.window.setGeometry(g) def wrborderMouseRelease(self, event): self.window.onResizeSignal.emit() def wbottomMousePress(self, event): self.h = self.window.height() def wbottomMouseMove(self, event): h = event.globalY() - self.wbottom.my + self.h g = self.window.geometry() g.setHeight(h) self.window.setGeometry(g) def wbottomMouseRelease(self, event): self.window.onResizeSignal.emit() def lconnerMousePress(self, event): self.h = self.window.height() self.w = self.window.width() def lconnerMouseMove(self, event): h = event.globalY() - self.lconner.my + self.h w = event.globalX() - self.lconner.mx + self.w g = self.window.geometry() g.setHeight(h) g.setWidth(w) self.window.setGeometry(g) def lconnerMouseRelease(self, event): self.window.onResizeSignal.emit() def ltitleMousePress(self, event): self.l = self.window.pos().x() self.t = self.window.pos().y() def ltitleMouseMove(self, event): t = event.globalY() - self.ltitle.my + self.t l = event.globalX() - self.ltitle.mx + self.l self.window.move(l, t) def ltitleMouseRelease(self, event): pass #self.window.onMovedSignal.emit() def retranslateUi(self, window): _translate = QtCore.QCoreApplication.translate window.setWindowTitle(_translate("window", "Form")) self.ltitle.setText(_translate("window", "UnTitled"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(900, 600) MainWindow.setStyleSheet("background-color: rgb(255, 255, 255);") self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.bottomWidget = QtWidgets.QWidget(self.centralwidget) self.bottomWidget.setGeometry(QtCore.QRect(60, 540, 771, 41)) self.bottomWidget.setStyleSheet("background-color: rgb(109, 255, 93);") self.bottomWidget.setObjectName("bottomWidget") self.gridLayout = QtWidgets.QGridLayout(self.bottomWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") spacerItem = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem, 0, 10, 1, 1) spacerItem1 = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem1, 0, 0, 1, 1) self.bindPhone = MyLabel(self.bottomWidget) self.bindPhone.setObjectName("bindPhone") self.gridLayout.addWidget(self.bindPhone, 0, 7, 1, 1) self.regOrLogin = MyLabel(self.bottomWidget) self.regOrLogin.setObjectName("regOrLogin") self.gridLayout.addWidget(self.regOrLogin, 0, 5, 1, 1) self.bindWechat = MyLabel(self.bottomWidget) self.bindWechat.setObjectName("bindWechat") self.gridLayout.addWidget(self.bindWechat, 0, 3, 1, 1) spacerItem2 = QtWidgets.QSpacerItem(206, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem2, 0, 2, 1, 1) spacerItem3 = QtWidgets.QSpacerItem(205, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem3, 0, 8, 1, 1) self.addKnowlege = MyLabel(self.bottomWidget) self.addKnowlege.setObjectName("addKnowlege") self.gridLayout.addWidget(self.addKnowlege, 0, 9, 1, 1) self.versionInfo = QtWidgets.QLabel(self.bottomWidget) self.versionInfo.setObjectName("versionInfo") self.gridLayout.addWidget(self.versionInfo, 0, 1, 1, 1) spacerItem4 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem4, 0, 4, 1, 1) spacerItem5 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem5, 0, 6, 1, 1) self.gridLayout.setColumnStretch(2, 1) self.gridLayout.setColumnStretch(8, 1) self.middleWidget = QtWidgets.QWidget(self.centralwidget) self.middleWidget.setGeometry(QtCore.QRect(130, 190, 571, 61)) self.middleWidget.setStyleSheet("background-color: rgb(170, 85, 0);") self.middleWidget.setObjectName("middleWidget") self.gridLayout_2 = QtWidgets.QGridLayout(self.middleWidget) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setObjectName("gridLayout_2") self.searchText = QtWidgets.QLineEdit(self.middleWidget) self.searchText.setObjectName("searchText") self.gridLayout_2.addWidget(self.searchText, 0, 0, 1, 1) self.searchBtn = MyLabel(self.middleWidget) self.searchBtn.setObjectName("searchBtn") self.gridLayout_2.addWidget(self.searchBtn, 0, 2, 1, 1) spacerItem6 = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_2.addItem(spacerItem6, 0, 1, 1, 1) spacerItem7 = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_2.addItem(spacerItem7, 0, 3, 1, 1) self.gridLayout_2.setColumnStretch(0, 1) self.topWidget = QtWidgets.QWidget(self.centralwidget) self.topWidget.setGeometry(QtCore.QRect(40, 20, 801, 41)) self.topWidget.setStyleSheet("background-color: rgb(255, 255, 127);") self.topWidget.setObjectName("topWidget") self.gridLayout_3 = QtWidgets.QGridLayout(self.topWidget) self.gridLayout_3.setContentsMargins(0, 0, 0, 0) self.gridLayout_3.setObjectName("gridLayout_3") spacerItem8 = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_3.addItem(spacerItem8, 0, 0, 1, 1) spacerItem9 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_3.addItem(spacerItem9, 0, 7, 1, 1) spacerItem10 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_3.addItem(spacerItem10, 0, 5, 1, 1) self.orgLogo = MyLabel(self.topWidget) self.orgLogo.setObjectName("orgLogo") self.gridLayout_3.addWidget(self.orgLogo, 0, 1, 1, 1) spacerItem11 = QtWidgets.QSpacerItem(540, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_3.addItem(spacerItem11, 0, 3, 1, 1) self.hiddenLab = MyLabel(self.topWidget) self.hiddenLab.setObjectName("hiddenLab") self.gridLayout_3.addWidget(self.hiddenLab, 0, 4, 1, 1) self.closeLab = MyLabel(self.topWidget) self.closeLab.setObjectName("closeLab") self.gridLayout_3.addWidget(self.closeLab, 0, 6, 1, 1) self.titleName = QtWidgets.QLabel(self.topWidget) self.titleName.setObjectName("titleName") self.gridLayout_3.addWidget(self.titleName, 0, 2, 1, 1) self.gridLayout_3.setColumnStretch(2, 1) self.org_logo = MyLabel(self.centralwidget) self.org_logo.setGeometry(QtCore.QRect(370, 140, 54, 12)) self.org_logo.setObjectName("org_logo") 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.bindPhone.setText(_translate("MainWindow", "TextLabel")) self.regOrLogin.setText(_translate("MainWindow", "TextLabel")) self.bindWechat.setText(_translate("MainWindow", "TextLabel")) self.addKnowlege.setText(_translate("MainWindow", "TextLabel")) self.versionInfo.setText(_translate("MainWindow", "TextLabel")) self.searchBtn.setText(_translate("MainWindow", "TextLabel")) self.orgLogo.setText(_translate("MainWindow", "TextLabel")) self.hiddenLab.setText(_translate("MainWindow", "TextLabel")) self.closeLab.setText(_translate("MainWindow", "TextLabel")) self.titleName.setText(_translate("MainWindow", "TextLabel")) self.org_logo.setText(_translate("MainWindow", "TextLabel"))