Warum kann man die Größe eines PYQT -Kontrollkästchen nicht ändern?Python

Python-Programme
Guest
 Warum kann man die Größe eines PYQT -Kontrollkästchen nicht ändern?

Post by Guest »

Der folgende Code wird ausgeführt, aber das Kontrollkästchen ist winzig (es sollte groß sein). Warum funktioniert das nicht wie erwartet? (Man kann das Styling verwenden, um die Größe des Textes zu ändern, aber das versuche ich hier nicht.) Ich werde dankbar für alle Vorschläge sein.

Code: Select all

import sys

from PyQt5.QtWidgets import (
QApplication,
QCheckBox,
QVBoxLayout,
QWidget,
)

class Window(QWidget):
def __init__(self, parent=None):
super().__init__(parent)

# Create a Checkbox with a text label:
chkBox = QCheckBox(text="Check box if you want this option.")

# Make the checkbox large (has no effect):
chkBox.setStyleSheet('QCheckBox::indicator {width:24px; height:24px}')

layout= QVBoxLayout()
layout.addWidget(chkBox)
self.setLayout(layout)

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

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post