学习日志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())
相关推荐
驭风少年君5 小时前
《搭建属于自己的网站之网页前端学习》基础入门
前端·学习
CIb0la7 小时前
能保持精神专注的爱好能给生活带来种种积极的转变
运维·学习·生活
行者游学8 小时前
ETCD 学习使用
数据库·学习·etcd
Python私教9 小时前
Unity 游戏开发「工业化级」学习路线 2025 版
学习·unity·游戏引擎
charlie1145141919 小时前
2D 计算机图形学基础速建——2
笔记·学习·线性代数·教程·计算机图形学
勇往直前plus11 小时前
学习和掌握RabbitMQ及其与springboot的整合实践(篇二)
spring boot·学习·rabbitmq·java-rabbitmq
py有趣12 小时前
LeetCode算法学习之杨辉三角
学习·算法·leetcode
具身新纪元12 小时前
现代机器人学习入门:一份来自Hugging Face与牛津大学的综合教程开源SOTA资源库
学习·机器人
~无忧花开~12 小时前
掌握Axios:前端HTTP请求全攻略
开发语言·前端·学习·js
敲代码的嘎仔13 小时前
JavaWeb零基础学习Day5——MySQL
java·数据库·学习·程序人生·mysql·adb·改行学it