学习日志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())
相关推荐
星恒随风2 小时前
Linux线程概念详解:从分页存储、页表、MMU与TLB,深入理解线程和进程的区别与联系
linux·运维·笔记·学习·状态模式
qq_284274052 小时前
数控机床编程基础与坐标系:编程六步流程、程序号/程序段/程序字格式,与右手定则下车床铣床XYZ轴判定(含考点)
笔记·学习·自动化·制造
德林恩宝2 小时前
On-Policy Distillation(OPD)学习文档
人工智能·学习·机器学习·大模型·llm·大模型微调
xxwl5852 小时前
区域赛分类题解
c++·笔记·学习·算法
xxwl5857 小时前
区域赛算法模版第八章---贪心(Greedy)
c++·笔记·学习·算法
qq_284274058 小时前
S7-1200 PLC硬件与启保停实训:CPU选型与DC/DC/DC、循环扫描五阶段、博途组态及电动机启停自锁梯形图(含考点)
笔记·学习·自动化·制造
dear_bi_MyOnly8 小时前
栈和队列:从原理到应用全解析
c语言·开发语言·c++·学习·分类
遇印记9 小时前
应用层,网络管理
运维·网络·windows·学习·安全
乌暮10 小时前
从 `println` 到生产级日志:Spring Boot 日志体系完全指南
java·开发语言·jvm·spring boot·后端·学习·面试
xian_wwq11 小时前
【学习笔记】Milvus 是什么?为什么 RAG 系统经常使用它?-14
笔记·学习·milvus