作业
import sysfrom PySide6.QtWidgets import QApplication, QWidget,QPushButton,QLineEditfrom Form import Ui_Form
from second import Ui_second
from PySide6.QtCore import Qtclass 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())