I'm trying to adjust the size of both the button and the text of a radio button widget in PyQt, with no luck at trying to do both.
With this bit of code:
radioButton = QRadioButton(options[x]['desc'])
radioButton.setStyleSheet('font: 16pt Helvetica MS; QRadioButton::indicator { width: 30px; height: 30px;};')
I get this:
small buttons, big text
but when I do this:
radioButton = QRadioButton(options[x]['desc'])
radioButton.setStyleSheet('QRadioButton::indicator { width: 30px; height: 30px;};')
I get this:
Big Buttons, Small Text
So what is the correct way to combine statements to get the Big Buttons/Big Text combination?
You have to use {}
'QRadioButton{properties} QRadioButton::indicator{properties};'
Example:
from PyQt5.QtWidgets import *
if __name__ == '__main__':
import sys
app = QApplication(sys.argv)
f = QFrame()
f.setLayout(QVBoxLayout())
for i in range(4):
r = QRadioButton("opt{}".format(i), f)
r.setStyleSheet('QRadioButton{font: 30pt Helvetica MS;} QRadioButton::indicator { width: 30px; height: 30px;};')
f.layout().addWidget(r)
f.show()
sys.exit(app.exec_())