学习日志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())
相关推荐
Surpass余sheng军26 分钟前
AI 时代下的网关技术选型
人工智能·经验分享·分布式·后端·学习·架构
2401_871260022 小时前
Java学习笔记(二)面向对象
java·python·学习
weixin_409383122 小时前
简单四方向a*学习记录10 重写前面的所有逻辑
学习
喏喏心3 小时前
深度强化学习:价值迭代与Bellman方程实践
人工智能·python·学习·机器学习
kkkkkkkkk_12013 小时前
【强化学习】06周博磊强化学习纲要学习笔记——第三课下
笔记·学习·强化学习
白杨SEO营销3 小时前
白杨SEO:看“20步:从0-1做项目的笨办法”来学习如何选一个项目做及经验分享
前端·学习
无所事事的程序员3 小时前
Claude指令学习
学习
学习路上_write3 小时前
AD5293驱动学习
c语言·单片机·嵌入式硬件·学习
菥菥爱嘻嘻4 小时前
组件测试--React Testing Library的学习
前端·学习·react.js
白帽子黑客罗哥4 小时前
零基础转行渗透测试 系统的学习流程(非常详细)
学习·网络安全·渗透测试·漏洞挖掘·护网行动