How can use different font & size for the child Widgets in the GroupBox and the tittle for the GroupBox in python
def panel(self):
groupBox = QtGui.QGroupBox("voltage Monitor")
groupBox.setFont(QtGui.QFont('SansSerif', 13)) # the title size is good
..
self.Voltage_Label = []
..
vbox = QtGui.QGridLayout()
self.Voltage_Label.append(QtGui.QLabel("voltage1 ")) # i need to have diff Font & size for these
self.Voltage_Label.append(QtGui.QLabel("voltage2 "))
self.Voltage_Label.append(QtGui.QLabel("voltage3 "))
..
vbox.addWidget(self.Voltage_Label[i], i, 0)
..
groupBox.setLayout(vbox)
return groupBox
I tired this
self.Voltage_Label.setFont(QtGui.QFont('SansSerif', 10))
I get this error
!! self.Voltage_Label.setFont(QtGui.QFont('SansSerif', 10))
AttributeError: 'list' object has no attribute 'setFont' !!
but for something like thistitle1 = QtGui.QLabel("Sample Title")
as a child widget i can change it by
title1.setFont(QtGui.QFont('SansSerif', 10))
While I was waiting for an answer I wanted to give it a try and found this method/solution for my question:
self.Voltage_Label = []
self.Voltage_Label.append(QtGui.QLabel("voltage1 ")) # i need to have diff Font & size for these
self.Voltage_Label.append(QtGui.QLabel("voltage2 "))
self.Voltage_Label.append(QtGui.QLabel("voltage3 "))
.
.
for i in xrange(5):
newfont = QtGui.QFont("Times", 8, QtGui.QFont.Bold)
self.Voltage_Label[i].setFont(newfont)