I have a many QRadioButton I had already grouped in an array
self.bounc1 = [self.bounc1_no, self.bounc1_1, self.bounc1_2, self.bounc1_3, self.bounc1_4, self.bounc1_5, self.bounc1_6]
self.bounc2 = [self.bounc2_no, self.bounc1_2, self.bounc2_2, self.bounc2_3, self.bounc2_4, self.bounc2_5, self.bounc2_6]
I have to return a list with [40, index of checked radio 1, index of checked radio 2], I can use a code like
ret = [40, 0, 0]
for i in range(7):
if self.bounc1[i].isChecked(): ret[1] = i
for i in range(7):
if self.bounc2[i].isChecked(): ret[2] = i
self.sendSerial.emit(ret)
Is there a way to make it in a single line like
self.sendSerial.emit([40, ...... , ......])
Thanks
PS: I've grouped QRadioButton in Qt creator, it seems there is not a simple way to set ID.