当前位置: 首页 pyqt5快速开发与实战_PyQt5项目实战案例 实现界面切换功能
add-vip

实现界面切换功能

实现界面切换功能

from PyQt5.Qt import *
import sys
from pyqt5.Demo.resource.main_register import Register
from pyqt5.Demo.resource.main_login import Login


class Window1(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("对外接口 - PyQt5中文网")
        self.resize(600, 500)
        self.func_list()

    def func_list(self):
        self.func()

    def func(self):
        pass


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Register()
    window.register_signal.connect(lambda a, b: print(a, b))
    login = Login()
    login.show()

    def check_login_cao(username, psd):
        if username == '85106210' and psd == '1234':
            window.show()
            login.hide()
        else:
            cutton = QPropertyAnimation(login)
            cutton.setTargetObject(login.widget_2)
            cutton.setPropertyName(b'pos')
            cutton.setKeyValueAt(0, login.widget_2.pos())
            cutton.setKeyValueAt(0.2, login.widget_2.pos() + QPoint(15, 0))
            cutton.setKeyValueAt(0.5, login.widget_2.pos())
            cutton.setKeyValueAt(0.7, login.widget_2.pos() - QPoint(15, 0))
            cutton.setKeyValueAt(1, login.widget_2.pos())
            cutton.setDuration(100)
            cutton.setLoopCount(3)
            cutton.start(QAbstractAnimation.DeleteWhenStopped)
            login.show()

    login.login_signal.connect(check_login_cao)

    sys.exit(app.exec_())





相关文章