学习日志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())
相关推荐
代码游侠8 分钟前
学习笔记——时钟系统与定时器
arm开发·笔记·单片机·嵌入式硬件·学习·架构
小魏每天都学习1 小时前
【计算机基础知识学习】
学习
Nan_Shu_6141 小时前
学习: 尚硅谷Java项目之尚庭公寓(2)
学习
好奇龙猫2 小时前
【人工智能学习-AI入试相关题目练习-第九次】
人工智能·学习
zhangrelay2 小时前
影响移动固态磁盘稳定性的原因有哪些呢?
笔记·学习
棒棒的皮皮3 小时前
【深度学习】YOLO学习教程汇总
深度学习·学习·yolo·计算机视觉
詩不诉卿3 小时前
Zephyr学习之spi flash驱动记录(w25q128)
学习
yanyu-yaya4 小时前
速学兼复习之vue3章节3
前端·javascript·vue.js·学习·前端框架
沉默-_-4 小时前
微信小程序网络请求 wx.request 详解
网络·学习·微信小程序·小程序
嗯嗯=5 小时前
STM32单片机学习篇5
stm32·单片机·学习