self.group1 = QButtonGroup(self) # 创建单选框组
lb1 = QLabel('表头1') # 添加选项标题
# 创建选项按钮
btn1 = QRadioButton('选项1')
btn2 = QRadioButton('选项2')
btn3 = QRadioButton('选项3')
# 添加选项到单选框组中
self.group1.addButton(btn1)
self.group1.addButton(btn2)
self.group1.addButton(btn3)
# 创建布局
h1 = QVBoxLayout() # 创建布局
# 添加到布局中
h1.addWidget(lb1)
h1.addWidget(btn1)
h1.addWidget(btn2)
h1.addWidget(btn3)
ml = QVBoxLayout() # 创建主布局
ml.addLayout(h1) # 布局添加到主布局中
self.setLayout(ml) # 设置主布局