学习日志020---qt信号与槽

作业

python 复制代码
import sys


from PySide6.QtWidgets import QApplication, QWidget,QPushButton,QLineEdit

from Form import Ui_Form
from second import Ui_second
from PySide6.QtCore import Qt

class MyWidget(QWidget,Ui_Form):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        self.btn = self.findChild(QPushButton,"btn")
        self.username =   self.findChild(QLineEdit,"username")
        self.password = self.findChild(QLineEdit, "password")
        self.btn.clicked.connect(mynext)

def mynext():
    if myWidget.username.text() == "admin" and myWidget.password.text() == "123456":
        myWidget.close()
        second.show()
    else:
        myWidget.username.setText("")
        myWidget.password.setText("")


class Second(QWidget,Ui_second):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

if __name__ == "__main__":
    app = QApplication(sys.argv)

    myWidget = MyWidget()
    myWidget.setWindowFlag(Qt.WindowType.FramelessWindowHint)

    myWidget.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)

    second = Second()
    second.setWindowFlag(Qt.WindowType.FramelessWindowHint)

    second.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
    myWidget.show()


    sys.exit(app.exec())
相关推荐
moxiaoran57532 小时前
uni-app学习笔记三十--request网络请求传参
笔记·学习·uni-app
嘉陵妹妹2 小时前
深度优先算法学习
学习·算法·深度优先
乖乖是干饭王3 小时前
Linux系统编程中的_GNU_SOURCE宏
linux·运维·c语言·学习·gnu
待什么青丝3 小时前
【TMS570LC4357】之相关驱动开发学习记录2
c语言·arm开发·驱动开发·单片机·学习
行云流水剑4 小时前
【学习记录】如何使用 Python 提取 PDF 文件中的内容
python·学习·pdf
虾球xz5 小时前
CppCon 2015 学习:CLANG/C2 for Windows
开发语言·c++·windows·学习
蓝婷儿5 小时前
6个月Python学习计划 Day 17 - 继承、多态与魔术方法
开发语言·python·学习
持续前进的奋斗鸭6 小时前
Postman测试学习(1)
学习·postman
hello kitty w6 小时前
Python学习(7) ----- Python起源
linux·python·学习
一叶知秋秋6 小时前
python学习day39
人工智能·深度学习·学习