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_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"))