Как сделать псевдошторку в приложении, Python\PySide6

Есть приложение, у него есть параметры:

  • root.setMinimumSize(QSize(560, 450));
  • root.setMaximumSize(QSize(560, 600)).

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

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

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

design.py:

from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
                            QMetaObject, QObject, QPoint, QRect,
                            QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
                           QFont, QFontDatabase, QGradient, QIcon,
                           QImage, QKeySequence, QLinearGradient, QPainter,
                           QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QLabel, QLineEdit, QMainWindow,
                               QPushButton, QSizePolicy, QTabWidget, QTextEdit,
                               QWidget)
import files_rc


class Ui_root(object):
    def setupUi(self, root):
        if not root.objectName():
            root.setObjectName(u"root")
        root.resize(560, 600)
        root.setMinimumSize(QSize(560, 450))
        root.setMaximumSize(QSize(560, 600))
        root.setCursor(QCursor(Qt.ArrowCursor))
        root.setMouseTracking(False)
        icon = QIcon()
        icon.addFile(u":/icon/icon.ico", QSize(), QIcon.Normal, QIcon.Off)
        root.setWindowIcon(icon)
        root.setWindowOpacity(1.000000000000000)
        root.setAutoFillBackground(False)
        root.setStyleSheet(u"")
        root.setDocumentMode(False)
        root.setTabShape(QTabWidget.Rounded)
        self.grid_w = QWidget(root)
        self.grid_w.setObjectName(u"grid_w")
        self.grid_w.setStyleSheet(u"")
        self.inputSummer = QLineEdit(self.grid_w)
        self.inputSummer.setObjectName(u"inputSummer")
        self.inputSummer.setGeometry(QRect(20, 40, 241, 31))
        self.inputSummer.setLayoutDirection(Qt.LeftToRight)
        self.inputSummer.setStyleSheet(u"")
        self.inputSummer.setMaxLength(32767)
        self.inputSummer.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignVCenter)
        self.inputSummer.setDragEnabled(False)
        self.outSummer = QLabel(self.grid_w)
        self.outSummer.setObjectName(u"outSummer")
        self.outSummer.setGeometry(QRect(20, 130, 241, 281))
        self.outSummer.setStyleSheet(u"background-color: rgba(230, 230, 230, 230);")
        self.outSummer.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignTop)
        self.btnSummer = QPushButton(self.grid_w)
        self.btnSummer.setObjectName(u"btnSummer")
        self.btnSummer.setGeometry(QRect(20, 80, 241, 41))
        self.btnSummer.setCursor(QCursor(Qt.PointingHandCursor))
        self.btnSummer.setStyleSheet(u"")
        self.btnWinter = QPushButton(self.grid_w)
        self.btnWinter.setObjectName(u"btnWinter")
        self.btnWinter.setGeometry(QRect(300, 80, 241, 41))
        self.btnWinter.setCursor(QCursor(Qt.PointingHandCursor))
        self.btnWinter.setStyleSheet(u"")
        self.outWinter = QLabel(self.grid_w)
        self.outWinter.setObjectName(u"outWinter")
        self.outWinter.setGeometry(QRect(300, 130, 241, 281))
        self.outWinter.setStyleSheet(u"background-color: rgb(230, 230, 230);")
        self.outWinter.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignTop)
        self.inputWinter = QLineEdit(self.grid_w)
        self.inputWinter.setObjectName(u"inputWinter")
        self.inputWinter.setGeometry(QRect(300, 40, 241, 31))
        self.inputWinter.setStyleSheet(u"")
        self.inputWinter.setMaxLength(10)
        self.label_s = QLabel(self.grid_w)
        self.label_s.setObjectName(u"label_s")
        self.label_s.setGeometry(QRect(20, 10, 241, 21))
        self.label_s.setStyleSheet(u"")
        self.lable_w = QLabel(self.grid_w)
        self.lable_w.setObjectName(u"lable_w")
        self.lable_w.setGeometry(QRect(300, 10, 241, 21))
        self.lable_w.setStyleSheet(u"")
        self.btnAbout = QPushButton(self.grid_w)
        self.btnAbout.setObjectName(u"btnAbout")
        self.btnAbout.setGeometry(QRect(20, 417, 29, 28))
        self.btnAbout.setStyleSheet(u"")
        icon1 = QIcon()
        icon1.addFile(u"info.png", QSize(), QIcon.Normal, QIcon.Off)
        self.btnAbout.setIcon(icon1)
        self.btnHelp = QPushButton(self.grid_w)
        self.btnHelp.setObjectName(u"btnHelp")
        self.btnHelp.setGeometry(QRect(55, 417, 30, 28))
        self.btnHelp.setStyleSheet(u"")
        icon2 = QIcon()
        icon2.addFile(u"help.png", QSize(), QIcon.Normal, QIcon.Off)
        self.btnHelp.setIcon(icon2)
        self.btnHelp.setAutoDefault(False)
        self.btnHelp.setFlat(False)
        self.btnGear = QPushButton(self.grid_w)
        self.btnGear.setObjectName(u"btnGear")
        self.btnGear.setGeometry(QRect(510, 417, 30, 28))
        self.btnGear.setStyleSheet(u"")
        icon3 = QIcon()
        icon3.addFile(u"gear.png", QSize(), QIcon.Normal, QIcon.Off)
        self.btnGear.setIcon(icon3)
        self.labelPropSummer = QLabel(self.grid_w)
        self.labelPropSummer.setObjectName(u"labelPropSummer")
        self.labelPropSummer.setGeometry(QRect(20, 470, 71, 16))
        self.applyPropSummer = QPushButton(self.grid_w)
        self.applyPropSummer.setObjectName(u"applyPropSummer")
        self.applyPropSummer.setGeometry(QRect(130, 490, 75, 31))
        self.inputPropSumer = QTextEdit(self.grid_w)
        self.inputPropSumer.setObjectName(u"inputPropSumer")
        self.inputPropSumer.setGeometry(QRect(20, 490, 104, 31))
        self.applyNormSummer = QPushButton(self.grid_w)
        self.applyNormSummer.setObjectName(u"applyNormSummer")
        self.applyNormSummer.setGeometry(QRect(130, 550, 75, 31))
        self.labelNormSummer = QLabel(self.grid_w)
        self.labelNormSummer.setObjectName(u"labelNormSummer")
        self.labelNormSummer.setGeometry(QRect(20, 530, 91, 16))
        self.inputNormSummer = QTextEdit(self.grid_w)
        self.inputNormSummer.setObjectName(u"inputNormSummer")
        self.inputNormSummer.setGeometry(QRect(20, 550, 104, 31))
        self.inputNormWinter = QTextEdit(self.grid_w)
        self.inputNormWinter.setObjectName(u"inputNormWinter")
        self.inputNormWinter.setGeometry(QRect(300, 550, 104, 31))
        self.labelPropWinter = QLabel(self.grid_w)
        self.labelPropWinter.setObjectName(u"labelPropWinter")
        self.labelPropWinter.setGeometry(QRect(300, 470, 71, 16))
        self.labelNormWinter = QLabel(self.grid_w)
        self.labelNormWinter.setObjectName(u"labelNormWinter")
        self.labelNormWinter.setGeometry(QRect(300, 530, 91, 16))
        self.applyNormWinter = QPushButton(self.grid_w)
        self.applyNormWinter.setObjectName(u"applyNormWinter")
        self.applyNormWinter.setGeometry(QRect(410, 550, 75, 31))
        self.applyPropWinter = QPushButton(self.grid_w)
        self.applyPropWinter.setObjectName(u"applyPropWinter")
        self.applyPropWinter.setGeometry(QRect(410, 490, 75, 31))
        self.inputPropWinter = QTextEdit(self.grid_w)
        self.inputPropWinter.setObjectName(u"inputPropWinter")
        self.inputPropWinter.setGeometry(QRect(300, 490, 104, 31))
        root.setCentralWidget(self.grid_w)

        self.retranslateUi(root)

        self.btnHelp.setDefault(False)
        self.btnGear.setDefault(False)

        QMetaObject.connectSlotsByName(root)

    # setupUi

    def retranslateUi(self, root):
        root.setWindowTitle(QCoreApplication.translate("root", u"BenzConfig", None))
        self.inputSummer.setInputMask("")
        self.inputSummer.setText("")
        self.inputSummer.setPlaceholderText(QCoreApplication.translate("root",
                                                                       u"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435",
                                                                       None))
        self.outSummer.setText("")
        self.btnSummer.setText(
            QCoreApplication.translate("root", u"\u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c", None))
        #if QT_CONFIG(shortcut)
        self.btnSummer.setShortcut(QCoreApplication.translate("root", u"Return", None))
        #endif // QT_CONFIG(shortcut)
        self.btnWinter.setText(
            QCoreApplication.translate("root", u"\u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c", None))
        #if QT_CONFIG(shortcut)
        self.btnWinter.setShortcut(QCoreApplication.translate("root", u"Return", None))
        #endif // QT_CONFIG(shortcut)
        self.outWinter.setText("")
        self.inputWinter.setText("")
        self.inputWinter.setPlaceholderText(QCoreApplication.translate("root",
                                                                       u"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435",
                                                                       None))
        self.label_s.setText(QCoreApplication.translate("root", u"\u041b\u0435\u0442\u043d\u0438\u0439", None))
        self.lable_w.setText(QCoreApplication.translate("root", u"\u0417\u0438\u043c\u043d\u0438\u0439", None))
        self.btnAbout.setText("")
        self.btnHelp.setText("")
        self.btnGear.setText("")
        self.labelPropSummer.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0438", None))
        self.applyPropSummer.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c", None))
        self.applyNormSummer.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c", None))
        self.labelNormSummer.setText(QCoreApplication.translate("root",
                                                                u"\u041d\u043e\u0440\u043c\u044b \u0440\u0430\u0441\u0445\u043e\u0434\u0430",
                                                                None))
        self.labelPropWinter.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0438", None))
        self.labelNormWinter.setText(QCoreApplication.translate("root",
                                                                u"\u041d\u043e\u0440\u043c\u044b \u0440\u0430\u0441\u0445\u043e\u0434\u0430",
                                                                None))
        self.applyNormWinter.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c", None))
        self.applyPropWinter.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c", None))
    # retranslateUi

main.py:

import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QMessageBox
from PySide6.QtGui import QPixmap, QIcon
from design import Ui_root

sys.argv += ['-platform', 'windows:darkmode=1']


class MainWindow(QMainWindow, Ui_root):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        self.btnSummer.clicked.connect(self.funcSummer)
        self.outSummer.show()
        self.btnWinter.clicked.connect(self.funcWinter)
        self.outWinter.show()

        self.btnAbout.clicked.connect(self.funcAbout)
        self.btnHelp.clicked.connect(self.funcHelp)

        self.btnGear.clicked.connect(self.funcGear)

    def funcGear(self):
        msg = QMessageBox.information(
            self, 'В разработке', f"Тут будет меню настроек")

    def funcSummer(self):
        try:
            inSummer = float(self.inputSummer.text())
            roadCity = round(0.3 * float(inSummer), 2)
            roadHighway = round(0.7 * float(inSummer), 2)
            resultCity = round(0.3 * float(inSummer) / 100 * 11.5, 2)
            resultHighway = round(0.7 * float(inSummer) / 100 * 8.5, 2)
            totalSummer = round((0.3 * inSummer / 100 * 11.5) + (0.7 * inSummer / 100 * 8.5), 2)
            """totalCity = round(float(inSummer) / 100 * 11.5, 2)
            totalHighway = round(float(inSummer) / 100 * 8.5, 2)"""

            self.outSummer.setText(
                f''
                f' Ваш пробег по городу {roadCity} км\n Потрачено по городу {resultCity} литров\n\n'
                f' Ваш пробег по трассе {roadHighway} км\n Потрачено по трассе {resultHighway} литров\n\n'
                f' Ваш общий расход {totalSummer} литров\n\n'
                f' Нормы расхода\n'
                f' Город: 11.5 на 100 км\n'
                f' Трасса: 8.5 на 100 км\n'
            )
        except Exception as e:
            msg = QMessageBox.information(
                self, 'Внимание', f"Что-то пошло не так. \n"
                                  f"Проверьте исходные данные.")

    def funcWinter(self):

        try:
            inWinter = float(self.inputWinter.text())
            roadCity = round(0.3 * float(inWinter), 2)
            roadHighway = round(0.7 * float(inWinter), 2)
            resultCity = round(0.3 * float(inWinter) / 100 * 13.8, 2)
            resultHighway = round(0.7 * float(inWinter) / 100 * 10.2, 2)
            totalWinter = round((0.3 * inWinter / 100 * 13.8) + (0.7 * inWinter / 100 * 10.2), 2)
            """totalCity = round(float(inWinter) / 100 * 13.8, 2)
            totalHighway = round(float(inWinter) / 100 * 10.2, 2)"""

            self.outWinter.setText(
                f''
                f' Ваш пробег по городу {roadCity} км\n Потрачено по городу {resultCity} литров\n\n'
                f' Ваш пробег по трассе {roadHighway} км\n Потрачено по трассе {resultHighway} литров\n\n'
                f' Ваш общий расход {totalWinter} литров\n\n'
                f' Нормы расхода\n'
                f' Город: 13.8 на 100 км\n'
                f' Трасса: 10.2 на 100 км\n'
            )

        except Exception as e:
            msg = QMessageBox.information(
                self, 'Внимание', f"Что-то пошло не так. \n"
                                  f"Проверьте исходные данные.")

    def funcAbout(self):
        strAbout = """
            BenzConfig ver. 0.7\n
            Copyright © Чекаев В.А.
            Ресурсы www.flaticon.com\n
            Лицензия
            GNU General Public License v3.0
            """

        msgAbout = QMessageBox()
        msgAbout.setWindowTitle("About")
        msgAbout.setWindowIcon(QIcon('infoMenu.svg'))

        msgAbout.setText(strAbout)
        msgAbout.setIconPixmap(QPixmap("iconAbout.png"))

        msgAbout.setStandardButtons(QMessageBox.Ok)
        msgAbout.exec()

    def funcHelp(self):
        strAbout = """
        Пропорции перерасчета расхода
        город/трасса 30% на 70%\n
        HOTKEYS
        Рассчет Летнего пробега клавиша "Enter"
        Рассчет Зимнего пробега клавиша "Tab"
            """

        msgAbout = QMessageBox()
        msgAbout.setWindowTitle("Help")
        msgAbout.setWindowIcon(QIcon('helpMenu.svg'))

        msgAbout.setText(strAbout)
        msgAbout.setIconPixmap(QPixmap("IconHelp.png"))

        msgAbout.setStandardButtons(QMessageBox.Ok)
        msgAbout.exec()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setStyle('Fusion')
    w = MainWindow()
    w.show()
    sys.exit(app.exec())

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

Автор решения: S. Nick

Установите свои импорты и изображения и попробуйте:

import sys
'''
from PySide6.QtWidgets import QApplication, QMainWindow, QMessageBox
from PySide6.QtGui import QPixmap, QIcon
'''
from PyQt5.Qt import *

# from design import Ui_root
class Ui_root(object):
    def setupUi(self, root):
        if not root.objectName():
            root.setObjectName(u"root")
        root.resize(560, 600)
        root.setMinimumSize(QSize(560, 450))
        root.setMaximumSize(QSize(560, 600))
        root.setCursor(QCursor(Qt.ArrowCursor))
        root.setMouseTracking(False)
        icon = QIcon()
# -------------------> vvvvvv <----------------------------------- установите свое
        icon.addFile(u"Ok.png", QSize(), QIcon.Normal, QIcon.Off)
        root.setWindowIcon(icon)
        root.setWindowOpacity(1.000000000000000)
        root.setAutoFillBackground(False)
        root.setStyleSheet(u"")
        root.setDocumentMode(False)
        root.setTabShape(QTabWidget.Rounded)
        self.grid_w = QWidget(root)
        self.grid_w.setObjectName(u"grid_w")
        self.grid_w.setStyleSheet(u"")
        self.inputSummer = QLineEdit(self.grid_w)
        self.inputSummer.setObjectName(u"inputSummer")
        self.inputSummer.setGeometry(QRect(20, 40, 241, 31))
        self.inputSummer.setLayoutDirection(Qt.LeftToRight)
        self.inputSummer.setStyleSheet(u"")
        self.inputSummer.setMaxLength(32767)
        self.inputSummer.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignVCenter)
        self.inputSummer.setDragEnabled(False)
        self.outSummer = QLabel(self.grid_w)
        self.outSummer.setObjectName(u"outSummer")
        self.outSummer.setGeometry(QRect(20, 130, 241, 281))
        self.outSummer.setStyleSheet(u"background-color: rgba(230, 230, 230, 230);")
        self.outSummer.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignTop)
        self.btnSummer = QPushButton(self.grid_w)
        self.btnSummer.setObjectName(u"btnSummer")
        self.btnSummer.setGeometry(QRect(20, 80, 241, 41))
        self.btnSummer.setCursor(QCursor(Qt.PointingHandCursor))
        self.btnSummer.setStyleSheet(u"")
        self.btnWinter = QPushButton(self.grid_w)
        self.btnWinter.setObjectName(u"btnWinter")
        self.btnWinter.setGeometry(QRect(300, 80, 241, 41))
        self.btnWinter.setCursor(QCursor(Qt.PointingHandCursor))
        self.btnWinter.setStyleSheet(u"")
        self.outWinter = QLabel(self.grid_w)
        self.outWinter.setObjectName(u"outWinter")
        self.outWinter.setGeometry(QRect(300, 130, 241, 281))
        self.outWinter.setStyleSheet(u"background-color: rgb(230, 230, 230);")
        self.outWinter.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignTop)
        self.inputWinter = QLineEdit(self.grid_w)
        self.inputWinter.setObjectName(u"inputWinter")
        self.inputWinter.setGeometry(QRect(300, 40, 241, 31))
        self.inputWinter.setStyleSheet(u"")
        self.inputWinter.setMaxLength(10)
        self.label_s = QLabel(self.grid_w)
        self.label_s.setObjectName(u"label_s")
        self.label_s.setGeometry(QRect(20, 10, 241, 21))
        self.label_s.setStyleSheet(u"")
        self.lable_w = QLabel(self.grid_w)
        self.lable_w.setObjectName(u"lable_w")
        self.lable_w.setGeometry(QRect(300, 10, 241, 21))
        self.lable_w.setStyleSheet(u"")
        self.btnAbout = QPushButton(self.grid_w)
        self.btnAbout.setObjectName(u"btnAbout")
        self.btnAbout.setGeometry(QRect(20, 417, 29, 28))
        self.btnAbout.setStyleSheet(u"")
        icon1 = QIcon()
# ------------------->  vvvvvvvv <----------------------------------- установите свое 
        icon1.addFile(u"ball.png", QSize(), QIcon.Normal, QIcon.Off)
        self.btnAbout.setIcon(icon1)
        self.btnHelp = QPushButton(self.grid_w)
        self.btnHelp.setObjectName(u"btnHelp")
        self.btnHelp.setGeometry(QRect(55, 417, 30, 28))
        self.btnHelp.setStyleSheet(u"")
        icon2 = QIcon()
# ------------------->  vvvvvvvv <----------------------------------- установите свое 
        icon2.addFile(u"ball.png", QSize(), QIcon.Normal, QIcon.Off)
        self.btnHelp.setIcon(icon2)
        self.btnHelp.setAutoDefault(False)
        self.btnHelp.setFlat(False)
        self.btnGear = QPushButton(self.grid_w)
        self.btnGear.setObjectName(u"btnGear")
        self.btnGear.setGeometry(QRect(510, 417, 30, 28))
        self.btnGear.setStyleSheet(u"")
        icon3 = QIcon()
# ------------------->  vvvvvvvv <----------------------------------- установите свое        
        icon3.addFile(u"im.png", QSize(), QIcon.Normal, QIcon.Off)
        self.btnGear.setIcon(icon3)
        self.labelPropSummer = QLabel(self.grid_w)
        self.labelPropSummer.setObjectName(u"labelPropSummer")
        self.labelPropSummer.setGeometry(QRect(20, 470, 71, 16))
        self.applyPropSummer = QPushButton(self.grid_w)
        self.applyPropSummer.setObjectName(u"applyPropSummer")
        self.applyPropSummer.setGeometry(QRect(130, 490, 75, 31))
        self.inputPropSumer = QTextEdit(self.grid_w)
        self.inputPropSumer.setObjectName(u"inputPropSumer")
        self.inputPropSumer.setGeometry(QRect(20, 490, 104, 31))
        self.applyNormSummer = QPushButton(self.grid_w)
        self.applyNormSummer.setObjectName(u"applyNormSummer")
        self.applyNormSummer.setGeometry(QRect(130, 550, 75, 31))
        self.labelNormSummer = QLabel(self.grid_w)
        self.labelNormSummer.setObjectName(u"labelNormSummer")
        self.labelNormSummer.setGeometry(QRect(20, 530, 91, 16))
        self.inputNormSummer = QTextEdit(self.grid_w)
        self.inputNormSummer.setObjectName(u"inputNormSummer")
        self.inputNormSummer.setGeometry(QRect(20, 550, 104, 31))
        self.inputNormWinter = QTextEdit(self.grid_w)
        self.inputNormWinter.setObjectName(u"inputNormWinter")
        self.inputNormWinter.setGeometry(QRect(300, 550, 104, 31))
        self.labelPropWinter = QLabel(self.grid_w)
        self.labelPropWinter.setObjectName(u"labelPropWinter")
        self.labelPropWinter.setGeometry(QRect(300, 470, 71, 16))
        self.labelNormWinter = QLabel(self.grid_w)
        self.labelNormWinter.setObjectName(u"labelNormWinter")
        self.labelNormWinter.setGeometry(QRect(300, 530, 91, 16))
        self.applyNormWinter = QPushButton(self.grid_w)
        self.applyNormWinter.setObjectName(u"applyNormWinter")
        self.applyNormWinter.setGeometry(QRect(410, 550, 75, 31))
        self.applyPropWinter = QPushButton(self.grid_w)
        self.applyPropWinter.setObjectName(u"applyPropWinter")
        self.applyPropWinter.setGeometry(QRect(410, 490, 75, 31))
        self.inputPropWinter = QTextEdit(self.grid_w)
        self.inputPropWinter.setObjectName(u"inputPropWinter")
        self.inputPropWinter.setGeometry(QRect(300, 490, 104, 31))
        root.setCentralWidget(self.grid_w)

        self.retranslateUi(root)
        self.btnHelp.setDefault(False)
        self.btnGear.setDefault(False)
        QMetaObject.connectSlotsByName(root)

    def retranslateUi(self, root):
        root.setWindowTitle(QCoreApplication.translate("root", u"BenzConfig", None))
        self.inputSummer.setInputMask("")
        self.inputSummer.setText("")
        self.inputSummer.setPlaceholderText(QCoreApplication.translate("root",
                                                                       u"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435",
                                                                       None))
        self.outSummer.setText("")
        self.btnSummer.setText(
            QCoreApplication.translate("root", u"\u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c", None))
        #if QT_CONFIG(shortcut)
        self.btnSummer.setShortcut(QCoreApplication.translate("root", u"Return", None))
        #endif // QT_CONFIG(shortcut)
        self.btnWinter.setText(
            QCoreApplication.translate("root", u"\u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c", None))
        #if QT_CONFIG(shortcut)
        self.btnWinter.setShortcut(QCoreApplication.translate("root", u"Return", None))
        #endif // QT_CONFIG(shortcut)
        self.outWinter.setText("")
        self.inputWinter.setText("")
        self.inputWinter.setPlaceholderText(QCoreApplication.translate("root",
                                                                       u"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435",
                                                                       None))
        self.label_s.setText(QCoreApplication.translate("root", u"\u041b\u0435\u0442\u043d\u0438\u0439", None))
        self.lable_w.setText(QCoreApplication.translate("root", u"\u0417\u0438\u043c\u043d\u0438\u0439", None))
        self.btnAbout.setText("")
        self.btnHelp.setText("")
        self.btnGear.setText("")
        self.labelPropSummer.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0438", None))
        self.applyPropSummer.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c", None))
        self.applyNormSummer.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c", None))
        self.labelNormSummer.setText(QCoreApplication.translate("root",
                                                                u"\u041d\u043e\u0440\u043c\u044b \u0440\u0430\u0441\u0445\u043e\u0434\u0430",
                                                                None))
        self.labelPropWinter.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0438", None))
        self.labelNormWinter.setText(QCoreApplication.translate("root",
                                                                u"\u041d\u043e\u0440\u043c\u044b \u0440\u0430\u0441\u0445\u043e\u0434\u0430",
                                                                None))
        self.applyNormWinter.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c", None))
        self.applyPropWinter.setText(
            QCoreApplication.translate("root", u"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c", None))


sys.argv += ['-platform', 'windows:darkmode=1']


class MainWindow(QMainWindow, Ui_root):

    def __init__(self):
        super().__init__()
        self.setupUi(self)

        self.btnSummer.clicked.connect(self.funcSummer)
# ?        self.outSummer.show()
        self.btnWinter.clicked.connect(self.funcWinter)
# ?        self.outWinter.show()

        self.btnAbout.clicked.connect(self.funcAbout)
        self.btnHelp.clicked.connect(self.funcHelp)
        
        self.btnGear.setCheckable(True)                               # <---- +++ 
        self.btnGear.clicked.connect(self.funcGear)

    def funcGear(self):
        if self.btnGear.isChecked():                                  # <---- +++ 
            self.resize(560, 600)                                     # <---- +++ 
        else:                                                         # <---- +++ 
            self.resize(560, 450)                                     # <---- +++ 
        
        msg = QMessageBox.information(
            self, 'В разработке', f"Тут будет меню настроек")

    def funcSummer(self):
        try:
            inSummer = float(self.inputSummer.text())
            roadCity = round(0.3 * float(inSummer), 2)
            roadHighway = round(0.7 * float(inSummer), 2)
            resultCity = round(0.3 * float(inSummer) / 100 * 11.5, 2)
            resultHighway = round(0.7 * float(inSummer) / 100 * 8.5, 2)
            totalSummer = round((0.3 * inSummer / 100 * 11.5) + (0.7 * inSummer / 100 * 8.5), 2)
            """totalCity = round(float(inSummer) / 100 * 11.5, 2)
            totalHighway = round(float(inSummer) / 100 * 8.5, 2)"""

            self.outSummer.setText(
                f''
                f' Ваш пробег по городу {roadCity} км\n Потрачено по городу {resultCity} литров\n\n'
                f' Ваш пробег по трассе {roadHighway} км\n Потрачено по трассе {resultHighway} литров\n\n'
                f' Ваш общий расход {totalSummer} литров\n\n'
                f' Нормы расхода\n'
                f' Город: 11.5 на 100 км\n'
                f' Трасса: 8.5 на 100 км\n'
            )
        except Exception as e:
            msg = QMessageBox.information(
                self, 'Внимание', f"Что-то пошло не так. \n"
                                  f"Проверьте исходные данные.")

    def funcWinter(self):
        try:
            inWinter = float(self.inputWinter.text())
            roadCity = round(0.3 * float(inWinter), 2)
            roadHighway = round(0.7 * float(inWinter), 2)
            resultCity = round(0.3 * float(inWinter) / 100 * 13.8, 2)
            resultHighway = round(0.7 * float(inWinter) / 100 * 10.2, 2)
            totalWinter = round((0.3 * inWinter / 100 * 13.8) + (0.7 * inWinter / 100 * 10.2), 2)
            """totalCity = round(float(inWinter) / 100 * 13.8, 2)
            totalHighway = round(float(inWinter) / 100 * 10.2, 2)"""

            self.outWinter.setText(
                f''
                f' Ваш пробег по городу {roadCity} км\n Потрачено по городу {resultCity} литров\n\n'
                f' Ваш пробег по трассе {roadHighway} км\n Потрачено по трассе {resultHighway} литров\n\n'
                f' Ваш общий расход {totalWinter} литров\n\n'
                f' Нормы расхода\n'
                f' Город: 13.8 на 100 км\n'
                f' Трасса: 10.2 на 100 км\n'
            )
        except Exception as e:
            msg = QMessageBox.information(
                self, 'Внимание', f"Что-то пошло не так. \n"
                                  f"Проверьте исходные данные.")

    def funcAbout(self):
        strAbout = """
            BenzConfig ver. 0.7\n
            Copyright © Чекаев В.А.
            Ресурсы www.flaticon.com\n
            Лицензия
            GNU General Public License v3.0
            """

        msgAbout = QMessageBox()
        msgAbout.setWindowTitle("About")
# --------------------------------->  vvvvvvvvv <------------------ установите свое 
        msgAbout.setWindowIcon(QIcon('image.svg'))

        msgAbout.setText(strAbout)
# ---------------------------------->  vvvvvvvvvv <---------------- установите свое 
        msgAbout.setIconPixmap(QPixmap("lena3.png"))

        msgAbout.setStandardButtons(QMessageBox.Ok)
        msgAbout.exec()

    def funcHelp(self):
        strAbout = """
        Пропорции перерасчета расхода
        город/трасса 30% на 70%\n
        HOTKEYS
        Рассчет Летнего пробега клавиша "Enter"
        Рассчет Зимнего пробега клавиша "Tab"
            """

        msgAbout = QMessageBox()
        msgAbout.setWindowTitle("Help")
# --------------------------------->  vvvvvv <------------------ установите свое         
        msgAbout.setWindowIcon(QIcon('im.svg'))

        msgAbout.setText(strAbout)
# --------------------------------->   vvvvvvvvvv <------------- установите свое 
        msgAbout.setIconPixmap(QPixmap("lena3.png"))

        msgAbout.setStandardButtons(QMessageBox.Ok)
        msgAbout.exec()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setStyle('Fusion')
    w = MainWindow()
    
    w.resize(560, 450)                                                # <---- +++

    w.show()
    sys.exit(app.exec())

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

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

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

→ Ссылка