0

enter image description here

  1. How I can remove close button from QMessageBox?
  2. How I can increase Title text?
class ErrorModal(QMessageBox):
    def __init__(self, parent: Optional[None] = None):
        super().__init__(parent=parent)
        self.findChild(QDialogButtonBox).setCenterButtons(True)
        font = self.font()
        font.setPointSize(20)
        self.setFont(font)
        self.setStyleSheet('QLabel{color:white;}')

        self.setStandardButtons(QMessageBox.Ok)
        self.setIcon(QMessageBox.Critical)
        self.setPalette(ErrorPalette())

  • Does this answer your question? [Can't hide or disable the close button on QWizard](https://stackoverflow.com/questions/27496686/cant-hide-or-disable-the-close-button-on-qwizard) – musicamante Apr 06 '22 at 18:06
  • 2
    Note that removing the close button might not work on all platforms, you might prefer overriding `closeEvent()` and ignore the event to prevent closing. The title font is not set by Qt, it depends on the system. If you want to customize it you will need to create your own title bar. – musicamante Apr 06 '22 at 18:07
  • That answer didn't help me. But you gave me an idea, thanks! – Sergey Derevianko Apr 06 '22 at 18:24

0 Answers0