学习日志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())
相关推荐
sinat_255487815 小时前
读者、作家 Java集合学习笔记
java·笔记·学习
Edward111111116 小时前
3.18异常学习
学习
正经人_x7 小时前
学习日记34:UNETR
学习
科技林总7 小时前
【系统分析师】12.3 软件架构描述与表示
学习
wincheshe7 小时前
AI Agent 开发学习 --- 框架开发实践(三)
人工智能·学习
2501_918126919 小时前
学习所有6502写游戏存档的语句
汇编·嵌入式硬件·学习·游戏·个人开发
星雨流星天的笔记本9 小时前
2.用洗洁精洗过的三口烧瓶的处理方法
学习
云边散步9 小时前
godot2D游戏教程系列二(18)
笔记·学习·游戏
風清掦10 小时前
【江科大STM32学习笔记-09】USART串口协议 - 9.1 STM32 USART串口外设
笔记·stm32·单片机·嵌入式硬件·学习
奶茶精Gaaa10 小时前
AI实战(二)生成ui自动化
功能测试·学习·自动化