继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

gif实现

lovingseapeak
关注TA
已关注
手记 3
粉丝 0
获赞 1

# -*- coding: utf-8 -*-


# Form implementation generated from reading ui file 'e:\NDC借調処理\python\src\StyleLayout.ui'

#

# Created by: PyQt5 UI code generator 5.13.0

#

# WARNING! All changes made in this file will be lost!


import sys

from PyQt5.QtWidgets import *

from PyQt5.QtCore import *

from PyQt5.QtGui import *




class tipWindow(QWidget):

    def __init__(self, rect, pos, parent=None):

        super(tipWindow, self).__init__(parent)

        # self.resize(200, 200)

        self.move(pos)

        self.setGeometry(rect)

        self.setObjectName("tipWindow")


        self.setStyleSheet("#tipWindow{background-color: rgb(150, 150, 150)}")

        self.setWindowModality(Qt.ApplicationModal)

        #self.setWindowModality(Qt.WindowModal )

        #self.setAttribute(Qt.WA_TranslucentBackground, True)

        self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.Tool)

        self.setWindowOpacity(0.8)

        self.setWindowTitle('遮挡界面')

        self.pushButton_enter = QPushButton()

        

        self.pushButton_enter.setText("文件正在执行。。。")

        

        self.label = QtWidgets.QLabel(tipWindow)

        self.label.setGeometry(QtCore.QRect(250, 150, 50, 50))

        self.gif = QMovie(":/img/down2.gif")

        self.label.setMovie(self.gif)

        self.gif.start()

        self.verticalLayout = QVBoxLayout()

        #self.pushButton_enter.setWindowOpacity(1)


        self.setLayout(self.verticalLayout)


        self.verticalLayout.addWidget(self.pushButton_enter)


        self.pushButton_enter.clicked.connect(self.close_win)


    def close_win(self):

        self.close()


class logindialog(QDialog):

    def __init__(self, *args, **kwargs):

        super().__init__(*args, **kwargs)

        self.setWindowTitle('登录界面')

        self.resize(200, 200)

        self.setFixedSize(self.width(), self.height())

        self.setWindowFlags(Qt.WindowCloseButtonHint)


        self.frame = QFrame(self)

        self.verticalLayout = QVBoxLayout(self.frame)

        self.lineEdit_account = QLineEdit()

        self.lineEdit_account.setPlaceholderText("请输入账号")

        self.verticalLayout.addWidget(self.lineEdit_account)


        self.lineEdit_password = QLineEdit()

        self.lineEdit_password.setPlaceholderText("请输入密码")

        self.verticalLayout.addWidget(self.lineEdit_password)


        self.pushButton_enter = QPushButton()

        self.pushButton_enter.setText("进入下一个界面")

        self.verticalLayout.addWidget(self.pushButton_enter)


        self.frame1 = QFrame(self)

        self.verticalLayout = QVBoxLayout(self.frame1)

        self.pushButton_quit = QPushButton()

        self.pushButton_quit.setText("回到主页面")

        self.verticalLayout.addWidget(self.pushButton_quit)

        self.frame1.setVisible(False)

        self.pushButton_enter.clicked.connect(self.on_pushButton_enter_clicked)

        self.pushButton_quit.clicked.connect(self.on_pushButton_enter_clicked_1)

        self.tipwin  = None



    def on_pushButton_enter_clicked(self):

        #self.frame1.setVisible(True)

        #self.frame.setVisible(False)

        # 窗口显示了之后才能正确得到在屏幕上的绝对坐标

        rect = self.frameGeometry()

        print(rect)

        x = self.x()

        print('x= ',x)

        y = self.y()

        print('y= ',y)

        pos = self.pos()

        print(pos)

        self.tipwin = tipWindow(rect, pos,self)

        self.tipwin.show()


    def on_pushButton_enter_clicked_1(self):

        self.frame1.setVisible(False)

        self.frame.setVisible(True)



if __name__ == "__main__":

    app = QApplication(sys.argv)

    dialog = logindialog()

    if dialog.exec_() == QDialog.Accepted:

        # the_window = MainWindow()

        # the_window.show()

        sys.exit(app.exec_())



打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP