Загрузка данных


import sys, PyQt6

from PyQt6.QtGui import QFont
from PyQt6.QtWidgets import QWidget, QLineEdit, QApplication, QPushButton, QHBoxLayout, QLabel, QSpinBox, QMessageBox


class MainWindow(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle('Окно авторизации')
        self.setGeometry(200,200,700,400)

        hbox = QHBoxLayout()

        label = QLabel('Laptop Price: ')
        label.setFont(QFont('Times', 15))
        self.setLayout(hbox)
        self.lineedit = QLineEdit()
        self.spinbox = QSpinBox()

        self.spinbox.valueChanged.connect(self.spin_selected)

        self.total_result = QLineEdit()
        self.total_result.setReadOnly(True)

        hbox.addWidget(label)
        hbox.addWidget(self.lineedit)
        hbox.addWidget(self.spinbox)
        hbox.addWidget(self.total_result)

    def spin_selected(self):
        try:
            if self.lineedit.text() != '':
                price = int(self.lineedit.text())
                totalPrice = self.spinbox.value() * price
                self.total_result.setText(str(totalPrice))

            else:
                self.total_result.setText('Введите цену')
        except ValueError:
            self.total_result.setText(f'Вы ввели не число, а строку: {self.lineedit.text()}')

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(app.exec())