Как реализовать переход между окнами, сохранить вводимые данные в первых двух окнах для дальнейшего использования в основном третьем окне?

Есть файл __init__.py, в котором я хочу создать список, который должен будет принять в себя данные из двух других файлов.

Сначала файл __init__.py запускает первый файл, в котором пользователь вводит какие-то данные.
Потом он нажимает "продолжить" и первое окно закрывается, и открывается новое, в котором он делает тоже самое, но после нажатия на кнопку "начать" второе окно закрывается, а в файле __init__.py находится список, который состоит из ранее введенных данных в эти два окна.

Я реализовал сбор данных с LineEdit в массив, но как объединить их и передать в начальный файл не могу понять?

Как это можно реализовать?

authorization.py:

import sys

from PyQt6.QtWidgets import QApplication, QMainWindow

from src.ui.py.OST_authorization import Ui_OST_authorization


class Authorization(QMainWindow):
    def __init__(self):
        super().__init__()

        self.ui = Ui_OST_authorization()
        self.ui.setupUi(self)

        self.ui.Continue.clicked.connect(self.student_data)
        self.show()

    def student_data(self) -> dict:
        return {"Имя": self.ui.Name.text(), "Фамилия": self.ui.Surname.text(), "Отчество": self.ui.Patronymic.text(),
                "Номер и буква класса": self.ui.Class.text(), "Серия": self.ui.Series.text(),
                "Номер": self.ui.Number.text()}


if __name__ == "__main__":
    app = QApplication(sys.argv)
    authorization_window = Authorization()
    sys.exit(app.exec())

OST_authorization.py:

from PyQt6 import QtCore, QtGui, QtWidgets


class Ui_OST_authorization(object):
    def setupUi(self, OST_authorization):
        OST_authorization.setObjectName("OST_authorization")
        OST_authorization.resize(330, 381)
        OST_authorization.setMinimumSize(QtCore.QSize(330, 381))
        OST_authorization.setMaximumSize(QtCore.QSize(330, 395))
        OST_authorization.setStyleSheet("QLineEdit#Name{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#Surname{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#Patronymic{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#Class{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#Series{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#Number{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QPushButton#Continue{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"")
        OST_authorization.setDocumentMode(True)
        self.centralwidget = QtWidgets.QWidget(parent=OST_authorization)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.Name = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Name.setEnabled(True)
        self.Name.setMinimumSize(QtCore.QSize(312, 35))
        self.Name.setMaximumSize(QtCore.QSize(312, 35))
        self.Name.setStyleSheet("")
        self.Name.setObjectName("Name")
        self.gridLayout.addWidget(self.Name, 5, 0, 1, 2)
        self.AuthorizationLable = QtWidgets.QLabel(parent=self.centralwidget)
        self.AuthorizationLable.setObjectName("AuthorizationLable")
        self.gridLayout.addWidget(self.AuthorizationLable, 4, 0, 1, 2)
        self.line = QtWidgets.QFrame(parent=self.centralwidget)
        self.line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line.setObjectName("line")
        self.gridLayout.addWidget(self.line, 8, 0, 1, 2)
        self.Class = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Class.setMinimumSize(QtCore.QSize(312, 35))
        self.Class.setMaximumSize(QtCore.QSize(312, 35))
        self.Class.setObjectName("Class")
        self.gridLayout.addWidget(self.Class, 9, 0, 1, 2)
        self.line_2 = QtWidgets.QFrame(parent=self.centralwidget)
        self.line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line_2.setObjectName("line_2")
        self.gridLayout.addWidget(self.line_2, 10, 0, 1, 2)
        self.Series = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Series.setMinimumSize(QtCore.QSize(312, 35))
        self.Series.setMaximumSize(QtCore.QSize(312, 35))
        self.Series.setObjectName("Series")
        self.gridLayout.addWidget(self.Series, 11, 0, 1, 2)
        self.Continue = QtWidgets.QPushButton(parent=self.centralwidget)
        self.Continue.setMinimumSize(QtCore.QSize(312, 35))
        self.Continue.setMaximumSize(QtCore.QSize(312, 35))
        self.Continue.setObjectName("Continue")
        self.gridLayout.addWidget(self.Continue, 14, 0, 1, 2)
        self.line_3 = QtWidgets.QFrame(parent=self.centralwidget)
        self.line_3.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line_3.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line_3.setObjectName("line_3")
        self.gridLayout.addWidget(self.line_3, 13, 0, 1, 2)
        self.Patronymic = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Patronymic.setMinimumSize(QtCore.QSize(312, 35))
        self.Patronymic.setMaximumSize(QtCore.QSize(312, 35))
        self.Patronymic.setObjectName("Patronymic")
        self.gridLayout.addWidget(self.Patronymic, 7, 0, 1, 2)
        self.Surname = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Surname.setMinimumSize(QtCore.QSize(312, 35))
        self.Surname.setMaximumSize(QtCore.QSize(312, 35))
        self.Surname.setObjectName("Surname")
        self.gridLayout.addWidget(self.Surname, 6, 0, 1, 2)
        self.Number = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Number.setMinimumSize(QtCore.QSize(312, 35))
        self.Number.setMaximumSize(QtCore.QSize(312, 35))
        self.Number.setObjectName("Number")
        self.gridLayout.addWidget(self.Number, 12, 0, 1, 2)
        OST_authorization.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(parent=OST_authorization)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 330, 22))
        self.menubar.setObjectName("menubar")
        OST_authorization.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(parent=OST_authorization)
        self.statusbar.setObjectName("statusbar")
        OST_authorization.setStatusBar(self.statusbar)

        self.retranslateUi(OST_authorization)
        QtCore.QMetaObject.connectSlotsByName(OST_authorization)

    def retranslateUi(self, OST_authorization):
        _translate = QtCore.QCoreApplication.translate
        OST_authorization.setWindowTitle(_translate("OST_authorization", "OST - (демо версия)"))
        self.Name.setPlaceholderText(_translate("OST_authorization", "Имя"))
        self.AuthorizationLable.setText(_translate("OST_authorization", "<html><head/><body><p><span style=\" font-size:12pt;\">Авторизация</span></p></body></html>"))
        self.Class.setPlaceholderText(_translate("OST_authorization", "Номер и буква класса"))
        self.Series.setPlaceholderText(_translate("OST_authorization", "Серия"))
        self.Continue.setText(_translate("OST_authorization", "Продолжить"))
        self.Patronymic.setPlaceholderText(_translate("OST_authorization", "Отчество (при наличии)"))
        self.Surname.setPlaceholderText(_translate("OST_authorization", "Фамилия"))
        self.Number.setPlaceholderText(_translate("OST_authorization", "Номер"))

task_settings.py:

import sys

from PyQt6.QtWidgets import QApplication, QMainWindow

from src.ui.py.OST_task_settings import Ui_OST_task_settings


class TaskSettings(QMainWindow):
    def __init__(self):
        super().__init__()

        self.ui = Ui_OST_task_settings()
        self.ui.setupUi(self)

        self.ui.Start.clicked.connect(self.settings_data)

        self.show()

    def settings_data(self) -> dict:
        return {"Код образовательной организации": self.ui.CodeEducationalOrganization.text(),
                "Код ППЭ": self.ui.PPECode.text(), "Номер компьютера": self.ui.NumberPC.text(),
                "Номер варианта": self.ui.NumberPC.text(), "Код активации": self.ui.CodeActivation.text()}


if __name__ == "__main__":
    app = QApplication(sys.argv)
    task_settings_window = TaskSettings()
    sys.exit(app.exec())

OST_task_settings.py:

from PyQt6 import QtCore, QtGui, QtWidgets


class Ui_OST_task_settings(object):
    def setupUi(self, OST_task_settings):
        OST_task_settings.setObjectName("OST_task_settings")
        OST_task_settings.resize(330, 381)
        OST_task_settings.setMinimumSize(QtCore.QSize(330, 381))
        OST_task_settings.setMaximumSize(QtCore.QSize(330, 395))
        OST_task_settings.setStyleSheet("QLineEdit#NumberOption{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QComboBox#SettingsOption{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#CodeActivation{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#CodeEducationalOrganization{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#NumberPC{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#PPECode{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QPushButton#Start{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}")
        OST_task_settings.setDocumentMode(True)
        self.centralwidget = QtWidgets.QWidget(parent=OST_task_settings)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.Start = QtWidgets.QPushButton(parent=self.centralwidget)
        self.Start.setMinimumSize(QtCore.QSize(312, 35))
        self.Start.setMaximumSize(QtCore.QSize(312, 35))
        self.Start.setObjectName("Start")
        self.gridLayout.addWidget(self.Start, 10, 0, 1, 1)
        self.line_2 = QtWidgets.QFrame(parent=self.centralwidget)
        self.line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line_2.setObjectName("line_2")
        self.gridLayout.addWidget(self.line_2, 9, 0, 1, 1)
        self.line = QtWidgets.QFrame(parent=self.centralwidget)
        self.line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line.setObjectName("line")
        self.gridLayout.addWidget(self.line, 7, 0, 1, 1)
        self.NumberOption = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.NumberOption.setMinimumSize(QtCore.QSize(312, 35))
        self.NumberOption.setMaximumSize(QtCore.QSize(312, 35))
        self.NumberOption.setObjectName("NumberOption")
        self.gridLayout.addWidget(self.NumberOption, 5, 0, 1, 1)
        self.line_3 = QtWidgets.QFrame(parent=self.centralwidget)
        self.line_3.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line_3.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line_3.setObjectName("line_3")
        self.gridLayout.addWidget(self.line_3, 4, 0, 1, 1)
        self.CodeActivation = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.CodeActivation.setMinimumSize(QtCore.QSize(312, 35))
        self.CodeActivation.setMaximumSize(QtCore.QSize(312, 35))
        self.CodeActivation.setObjectName("CodeActivation")
        self.gridLayout.addWidget(self.CodeActivation, 8, 0, 1, 1)
        self.SettingsOption = QtWidgets.QComboBox(parent=self.centralwidget)
        self.SettingsOption.setMinimumSize(QtCore.QSize(312, 35))
        self.SettingsOption.setMaximumSize(QtCore.QSize(312, 35))
        self.SettingsOption.setObjectName("SettingsOption")
        self.SettingsOption.addItem("")
        self.SettingsOption.addItem("")
        self.SettingsOption.addItem("")
        self.gridLayout.addWidget(self.SettingsOption, 6, 0, 1, 1)
        self.PPECode = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.PPECode.setMinimumSize(QtCore.QSize(312, 35))
        self.PPECode.setMaximumSize(QtCore.QSize(312, 35))
        self.PPECode.setObjectName("PPECode")
        self.gridLayout.addWidget(self.PPECode, 2, 0, 1, 1)
        self.label = QtWidgets.QLabel(parent=self.centralwidget)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.NumberPC = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.NumberPC.setMinimumSize(QtCore.QSize(312, 35))
        self.NumberPC.setMaximumSize(QtCore.QSize(312, 35))
        self.NumberPC.setObjectName("NumberPC")
        self.gridLayout.addWidget(self.NumberPC, 3, 0, 1, 1)
        self.CodeEducationalOrganization = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.CodeEducationalOrganization.setMinimumSize(QtCore.QSize(312, 35))
        self.CodeEducationalOrganization.setMaximumSize(QtCore.QSize(312, 35))
        self.CodeEducationalOrganization.setObjectName("CodeEducationalOrganization")
        self.gridLayout.addWidget(self.CodeEducationalOrganization, 1, 0, 1, 1)
        OST_task_settings.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(parent=OST_task_settings)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 330, 22))
        self.menubar.setObjectName("menubar")
        OST_task_settings.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(parent=OST_task_settings)
        self.statusbar.setObjectName("statusbar")
        OST_task_settings.setStatusBar(self.statusbar)

        self.retranslateUi(OST_task_settings)
        QtCore.QMetaObject.connectSlotsByName(OST_task_settings)

    def retranslateUi(self, OST_task_settings):
        _translate = QtCore.QCoreApplication.translate
        OST_task_settings.setWindowTitle(_translate("OST_task_settings", "OST - (демо версия)"))
        self.Start.setText(_translate("OST_task_settings", "Начать"))
        self.NumberOption.setPlaceholderText(_translate("OST_task_settings", "Номер варианта"))
        self.CodeActivation.setPlaceholderText(_translate("OST_task_settings", "Код активации"))
        self.SettingsOption.setItemText(0, _translate("OST_task_settings", "[Без дополнений]"))
        self.SettingsOption.setItemText(1, _translate("OST_task_settings", "Случайный вариант"))
        self.SettingsOption.setItemText(2, _translate("OST_task_settings", "Составить вариант"))
        self.PPECode.setPlaceholderText(_translate("OST_task_settings", "Код ППЭ"))
        self.label.setText(_translate("OST_task_settings", "<html><head/><body><p><span style=\" font-size:12pt;\">Дополнительные данные</span></p></body></html>"))
        self.NumberPC.setPlaceholderText(_translate("OST_task_settings", "Номер компьютера"))
        self.CodeEducationalOrganization.setPlaceholderText(_translate("OST_task_settings", "Код образовательной организации"))

Ответы (1 шт):

Автор решения: S. Nick
  1. Вы не правильно даете имена переменным и методам.
    Ознакомьтесь с PEP 8 – Style Guide for Python Code

  2. Можно сделать по-разному, но обычно используют QStackedWidget Class
    Класс QStackedWidget предоставляет стек виджетов, в котором одновременно виден только один виджет.

  3. Класс QSettings обеспечивает постоянные, независимые от платформы настройки приложения.

Поменяйте импорты на свои и попробуйте

main.py

import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.Qt import *

from authorization import Authorization                       # +++
from task_settings import TaskSettings                        # +++

class Page3(QtWidgets.QWidget):
    def __init__(self, parent):
        super().__init__(parent)
        self.parent = parent

        self.label = QtWidgets.QLabel(self)
        self.label.setStyleSheet("border-image:url(cat.jpg);")
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        newfont = QtGui.QFont("Consolas", 25, QtGui.QFont.Bold)
        self.label.setFont(newfont)

        layout = QtWidgets.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.label)        
        
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.showTime)        
        self.timer.start(1000)
    
    def showTime(self):
        time = QtCore.QTime.currentTime()
        text = time.toString('hh:mm')        
        if (time.second() % 2) == 0:
            text = text[:2] + ' ' + text[3:]        
        self.label.setText(text)
        
    def _start(self):  
        self.timer.stop()
        self.label.setText(f'''
Name: {self.parent.page1.Name.text()}
Surname: {self.parent.page1.Surname.text()}
Patronymic: {self.parent.page1.Patronymic.text()}
CodeActivation: {self.parent.page2.CodeActivation.text()}
        ''')
        
        
class MainWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()

        self.centralWidget = QtWidgets.QWidget()
        self.setCentralWidget(self.centralWidget)
        
        self.page1 = Authorization()
        self.page1.Continue.clicked.connect(self.student_data)
        
        self.page2 = TaskSettings()
        self.page2.Start.clicked.connect(self.settings_data)

        self.page3 = Page3(self)

        self.stackedwidget = QtWidgets.QStackedWidget()       # !!! +++
        self.stackedwidget.addWidget(self.page1)
        self.stackedwidget.addWidget(self.page2)
        self.stackedwidget.addWidget(self.page3)
                    
        layout = QtWidgets.QVBoxLayout(self.centralWidget)        
        layout.addWidget(self.stackedwidget) 

        self.stackedwidget.setCurrentIndex(0)
        
        self.load_settings()                                  # !!! +++

    def student_data(self):
        if not self.page1.Name.text() or not self.page1.Surname.text() or \
            not self.page1.Patronymic.text() or not self.page1.Class.text() or \
            not self.page1.Series.text() or not self.page1.Number.text():
            msg = QtWidgets.QMessageBox.information(
                self, 
                'Внимание', 
                'Не заполнены все объязательные поля ввода.\n'
                'Повторите попытку ввода.')
            return
        self.stackedwidget.setCurrentIndex(1)
 
    def settings_data(self): 
        self.resize(620, 480)
        self.stackedwidget.setCurrentIndex(2)
        
        QtCore.QTimer.singleShot(3000, self.page3._start)
        

    def closeEvent(self, event):                               # !!! +++
            self.save_settings()
            event.accept()

    def save_settings(self):                                   # !!! +++
        settings = QtCore.QSettings(
            "q1594497_settings.ini", QtCore.QSettings.IniFormat)
        settings.setValue("Name", self.page1.Name.text())
        settings.setValue("Surname", self.page1.Surname.text())
        settings.setValue("Patronymic", self.page1.Patronymic.text())
        settings.setValue("Class", self.page1.Class.text())
        settings.setValue("Series", self.page1.Series.text())
        settings.setValue("Number", self.page1.Number.text())
        
        settings.setValue("CodeEducationalOrganization", 
                           self.page2.CodeEducationalOrganization.text())
        settings.setValue("PPECode", self.page2.PPECode.text())
        settings.setValue("NumberPC", self.page2.NumberPC.text())
        settings.setValue("NumberOption", self.page2.NumberOption.text())
        settings.setValue("SettingsOption", self.page2.SettingsOption.currentText())
        settings.setValue("CodeActivation", self.page2.CodeActivation.text())        

    def load_settings(self):                                    # !!! +++
        settings = QtCore.QSettings(
            "q1594497_settings.ini", QtCore.QSettings.IniFormat) 
        self.page1.Name.setText(settings.value('Name', ""))
        self.page1.Surname.setText(settings.value('Surname', ""))
        self.page1.Patronymic.setText(settings.value('Patronymic', ""))
        self.page1.Class.setText(settings.value('Class', ""))
        self.page1.Series.setText(settings.value('Series', ""))
        self.page1.Number.setText(settings.value('Number', ""))

        self.page2.CodeEducationalOrganization.setText(
            settings.value('CodeEducationalOrganization', ""))
        self.page2.PPECode.setText(settings.value('PPECode', ""))
        self.page2.NumberPC.setText(settings.value('NumberPC', ""))
        self.page2.NumberOption.setText(settings.value('NumberOption', ""))
        self.page2.SettingsOption.setCurrentText(settings.value('SettingsOption', "[Без дополнений]"))
        self.page2.CodeActivation.setText(settings.value('CodeActivation', ""))


if __name__ == "__main__":
    import sys
    
    app = QtWidgets.QApplication(sys.argv)
    w = MainWindow()
    w.resize(330, 381)
    w.show()
    sys.exit(app.exec())

authorization.py

import sys
'''
from PyQt6.QtWidgets import QApplication, QMainWindow
...
'''
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.Qt import *


#from src.ui.py.OST_authorization import Ui_OST_authorization
class Ui_OST_authorization(object):
    def setupUi(self, OST_authorization):
        OST_authorization.setObjectName("OST_authorization")
        OST_authorization.resize(330, 381)
        OST_authorization.setMinimumSize(QtCore.QSize(330, 381))
        OST_authorization.setMaximumSize(QtCore.QSize(330, 381))
        OST_authorization.setStyleSheet("QLineEdit#Name{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#Surname{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#Patronymic{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#Class{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#Series{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#Number{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QPushButton#Continue{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"")
        OST_authorization.setDocumentMode(True)
        self.centralwidget = QtWidgets.QWidget(parent=OST_authorization)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.Name = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Name.setEnabled(True)
        self.Name.setMinimumSize(QtCore.QSize(312, 35))
        self.Name.setMaximumSize(QtCore.QSize(312, 35))
        self.Name.setStyleSheet("")
        self.Name.setObjectName("Name")
        self.gridLayout.addWidget(self.Name, 5, 0, 1, 2)
        self.AuthorizationLable = QtWidgets.QLabel(parent=self.centralwidget)
        self.AuthorizationLable.setObjectName("AuthorizationLable")
        self.gridLayout.addWidget(self.AuthorizationLable, 4, 0, 1, 2)
        self.line = QtWidgets.QFrame(parent=self.centralwidget)
        self.line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line.setObjectName("line")
        self.gridLayout.addWidget(self.line, 8, 0, 1, 2)
        self.Class = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Class.setMinimumSize(QtCore.QSize(312, 35))
        self.Class.setMaximumSize(QtCore.QSize(312, 35))
        self.Class.setObjectName("Class")
        self.gridLayout.addWidget(self.Class, 9, 0, 1, 2)
        self.line_2 = QtWidgets.QFrame(parent=self.centralwidget)
        self.line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line_2.setObjectName("line_2")
        self.gridLayout.addWidget(self.line_2, 10, 0, 1, 2)
        self.Series = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Series.setMinimumSize(QtCore.QSize(312, 35))
        self.Series.setMaximumSize(QtCore.QSize(312, 35))
        self.Series.setObjectName("Series")
        self.gridLayout.addWidget(self.Series, 11, 0, 1, 2)
        self.Continue = QtWidgets.QPushButton(parent=self.centralwidget)
        self.Continue.setMinimumSize(QtCore.QSize(312, 35))
        self.Continue.setMaximumSize(QtCore.QSize(312, 35))
        self.Continue.setObjectName("Continue")
        self.gridLayout.addWidget(self.Continue, 14, 0, 1, 2)
        self.line_3 = QtWidgets.QFrame(parent=self.centralwidget)
        self.line_3.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line_3.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line_3.setObjectName("line_3")
        self.gridLayout.addWidget(self.line_3, 13, 0, 1, 2)
        self.Patronymic = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Patronymic.setMinimumSize(QtCore.QSize(312, 35))
        self.Patronymic.setMaximumSize(QtCore.QSize(312, 35))
        self.Patronymic.setObjectName("Patronymic")
        self.gridLayout.addWidget(self.Patronymic, 7, 0, 1, 2)
        self.Surname = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Surname.setMinimumSize(QtCore.QSize(312, 35))
        self.Surname.setMaximumSize(QtCore.QSize(312, 35))
        self.Surname.setObjectName("Surname")
        self.gridLayout.addWidget(self.Surname, 6, 0, 1, 2)
        self.Number = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.Number.setMinimumSize(QtCore.QSize(312, 35))
        self.Number.setMaximumSize(QtCore.QSize(312, 35))
        self.Number.setObjectName("Number")
        self.gridLayout.addWidget(self.Number, 12, 0, 1, 2)
        OST_authorization.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(parent=OST_authorization)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 330, 22))
        self.menubar.setObjectName("menubar")
        OST_authorization.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(parent=OST_authorization)
        self.statusbar.setObjectName("statusbar")
        OST_authorization.setStatusBar(self.statusbar)

        self.retranslateUi(OST_authorization)
        QtCore.QMetaObject.connectSlotsByName(OST_authorization)

    def retranslateUi(self, OST_authorization):
        _translate = QtCore.QCoreApplication.translate
        OST_authorization.setWindowTitle(_translate("OST_authorization", "OST - (демо версия)"))
        self.Name.setPlaceholderText(_translate("OST_authorization", "Имя"))
        self.AuthorizationLable.setText(_translate("OST_authorization", "<html><head/><body><p><span style=\" font-size:12pt;\">Авторизация</span></p></body></html>"))
        self.Class.setPlaceholderText(_translate("OST_authorization", "Номер и буква класса"))
        self.Series.setPlaceholderText(_translate("OST_authorization", "Серия"))
        self.Continue.setText(_translate("OST_authorization", "Продолжить"))
        self.Patronymic.setPlaceholderText(_translate("OST_authorization", "Отчество (при наличии)"))
        self.Surname.setPlaceholderText(_translate("OST_authorization", "Фамилия"))
        self.Number.setPlaceholderText(_translate("OST_authorization", "Номер"))
        

class Authorization(QMainWindow, Ui_OST_authorization):
    def __init__(self):
        super().__init__()
        self.setupUi(self)


if __name__ == "__main__":
    app = QApplication(sys.argv)
    authorization_window = Authorization()
    authorization_window.show()
    sys.exit(app.exec())

task_settings.py

import sys
'''
from PyQt6.QtWidgets import QApplication, QMainWindow
'''
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.Qt import *

#from src.ui.py.OST_task_settings import Ui_OST_task_settings
class Ui_OST_task_settings(object):
    def setupUi(self, OST_task_settings):
        OST_task_settings.setObjectName("OST_task_settings")
        OST_task_settings.resize(330, 381)
        OST_task_settings.setMinimumSize(QtCore.QSize(330, 381))
                                                     #330, 395
        OST_task_settings.setMaximumSize(QtCore.QSize(330, 381))
        OST_task_settings.setStyleSheet("QLineEdit#NumberOption{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QComboBox#SettingsOption{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#CodeActivation{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#CodeEducationalOrganization{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#NumberPC{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QLineEdit#PPECode{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}\n"
"QPushButton#Start{\n"
"    min-width:  310px;\n"
"    min-height: 33px;\n"
"    max-width:  310px;\n"
"    max-height: 33px;\n"
"}")
        OST_task_settings.setDocumentMode(True)
        self.centralwidget = QtWidgets.QWidget(parent=OST_task_settings)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.Start = QtWidgets.QPushButton(parent=self.centralwidget)
        self.Start.setMinimumSize(QtCore.QSize(312, 35))
        self.Start.setMaximumSize(QtCore.QSize(312, 35))
        self.Start.setObjectName("Start")
        self.gridLayout.addWidget(self.Start, 10, 0, 1, 1)
        self.line_2 = QtWidgets.QFrame(parent=self.centralwidget)
        self.line_2.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line_2.setObjectName("line_2")
        self.gridLayout.addWidget(self.line_2, 9, 0, 1, 1)
        self.line = QtWidgets.QFrame(parent=self.centralwidget)
        self.line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line.setObjectName("line")
        self.gridLayout.addWidget(self.line, 7, 0, 1, 1)
        self.NumberOption = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.NumberOption.setMinimumSize(QtCore.QSize(312, 35))
        self.NumberOption.setMaximumSize(QtCore.QSize(312, 35))
        self.NumberOption.setObjectName("NumberOption")
        self.gridLayout.addWidget(self.NumberOption, 5, 0, 1, 1)
        self.line_3 = QtWidgets.QFrame(parent=self.centralwidget)
        self.line_3.setFrameShape(QtWidgets.QFrame.Shape.HLine)
        self.line_3.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
        self.line_3.setObjectName("line_3")
        self.gridLayout.addWidget(self.line_3, 4, 0, 1, 1)
        self.CodeActivation = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.CodeActivation.setMinimumSize(QtCore.QSize(312, 35))
        self.CodeActivation.setMaximumSize(QtCore.QSize(312, 35))
        self.CodeActivation.setObjectName("CodeActivation")
        self.gridLayout.addWidget(self.CodeActivation, 8, 0, 1, 1)
        self.SettingsOption = QtWidgets.QComboBox(parent=self.centralwidget)
        self.SettingsOption.setMinimumSize(QtCore.QSize(312, 35))
        self.SettingsOption.setMaximumSize(QtCore.QSize(312, 35))
        self.SettingsOption.setObjectName("SettingsOption")
        self.SettingsOption.addItem("")
        self.SettingsOption.addItem("")
        self.SettingsOption.addItem("")
        self.gridLayout.addWidget(self.SettingsOption, 6, 0, 1, 1)
        self.PPECode = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.PPECode.setMinimumSize(QtCore.QSize(312, 35))
        self.PPECode.setMaximumSize(QtCore.QSize(312, 35))
        self.PPECode.setObjectName("PPECode")
        self.gridLayout.addWidget(self.PPECode, 2, 0, 1, 1)
        self.label = QtWidgets.QLabel(parent=self.centralwidget)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.NumberPC = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.NumberPC.setMinimumSize(QtCore.QSize(312, 35))
        self.NumberPC.setMaximumSize(QtCore.QSize(312, 35))
        self.NumberPC.setObjectName("NumberPC")
        self.gridLayout.addWidget(self.NumberPC, 3, 0, 1, 1)
        self.CodeEducationalOrganization = QtWidgets.QLineEdit(parent=self.centralwidget)
        self.CodeEducationalOrganization.setMinimumSize(QtCore.QSize(312, 35))
        self.CodeEducationalOrganization.setMaximumSize(QtCore.QSize(312, 35))
        self.CodeEducationalOrganization.setObjectName("CodeEducationalOrganization")
        self.gridLayout.addWidget(self.CodeEducationalOrganization, 1, 0, 1, 1)
        OST_task_settings.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(parent=OST_task_settings)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 330, 22))
        self.menubar.setObjectName("menubar")
        OST_task_settings.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(parent=OST_task_settings)
        self.statusbar.setObjectName("statusbar")
        OST_task_settings.setStatusBar(self.statusbar)

        self.retranslateUi(OST_task_settings)
        QtCore.QMetaObject.connectSlotsByName(OST_task_settings)

    def retranslateUi(self, OST_task_settings):
        _translate = QtCore.QCoreApplication.translate
        OST_task_settings.setWindowTitle(_translate("OST_task_settings", "OST - (демо версия)"))
        self.Start.setText(_translate("OST_task_settings", "Начать"))
        self.NumberOption.setPlaceholderText(_translate("OST_task_settings", "Номер варианта"))
        self.CodeActivation.setPlaceholderText(_translate("OST_task_settings", "Код активации"))
        self.SettingsOption.setItemText(0, _translate("OST_task_settings", "[Без дополнений]"))
        self.SettingsOption.setItemText(1, _translate("OST_task_settings", "Случайный вариант"))
        self.SettingsOption.setItemText(2, _translate("OST_task_settings", "Составить вариант"))
        self.PPECode.setPlaceholderText(_translate("OST_task_settings", "Код ППЭ"))
        self.label.setText(_translate("OST_task_settings", "<html><head/><body><p><span style=\" font-size:12pt;\">Дополнительные данные</span></p></body></html>"))
        self.NumberPC.setPlaceholderText(_translate("OST_task_settings", "Номер компьютера"))
        self.CodeEducationalOrganization.setPlaceholderText(_translate("OST_task_settings", "Код образовательной организации"))


class TaskSettings(QMainWindow, Ui_OST_task_settings):
    def __init__(self):
        super().__init__()
        self.setupUi(self)


if __name__ == "__main__":
    app = QApplication(sys.argv)
    task_settings_window = TaskSettings()
    task_settings_window.show()
    sys.exit(app.exec())

введите сюда описание изображения

введите сюда описание изображения

введите сюда описание изображения


введите сюда описание изображения

→ Ссылка