import sys

from PyQt6.QtCore import QSize
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import (
    QApplication,
    QCheckBox,
    QHBoxLayout,
    QLabel,
    QVBoxLayout,
    QWidget,
)

ICON_SIZE = 100


class Window(QWidget):
    def __init__(self) -> None:
        super().__init__()
        self.setGeometry(200, 200, 400, 300)
        self.setWindowTitle("Окно")
        self.create_radio()

    def create_radio(self) -> None:
        hbox = QHBoxLayout()

        self.check1 = QCheckBox("Cat 1")
        self.check1.setIcon(QIcon("cat1.jpg"))
        self.check1.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
        self.check1.toggled.connect(self.radio_selected)

        self.check2 = QCheckBox("Cat 2")
        self.check2.setIcon(QIcon("cat2.jpg"))
        self.check2.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
        self.check2.toggled.connect(self.radio_selected)

        hbox.addWidget(self.check1)
        hbox.addWidget(self.check2)

        vbox = QVBoxLayout()

        self.label = QLabel("You haven't chosen anything")

        vbox.addWidget(self.label)
        vbox.addLayout(hbox)
        self.setLayout(vbox)

    def radio_selected(self) -> None:
        text = "You have chosen "
        if self.check1.isChecked():
            text += self.check1.text().lower() + ", "
        if self.check2.isChecked():
            text += self.check2.text().lower()
        if not any((self.check1.isChecked(), self.check2.isChecked())):
            text = "You haven't chosen anything"
        text = text.removesuffix(", ")
        self.label.setText(text)


def main() -> None:
    app = QApplication(sys.argv)
    window = Window()
    window.show()
    sys.exit(app.exec())


if __name__ == "__main__":
    main()
