我正在用 PyQt 编写一个向导。在第一页上,我想让用户在两个选项之间选择两次。因此,我决定制作 Buttongroups。但是虽然我将前两个单选按钮添加到第一个 Buttongroup 并将另外两个添加到第二个按钮组,但这些按钮仍然是独占的(我只能在页面上选择一个按钮)。
这是我的代码:
# Setup UI
layout = QtGui.QVBoxLayout()
gBBackupFromIntExt = QtGui.QGroupBox()
layout.addWidget(gBBackupFromIntExt)
bGBackupFromIntExt = QtGui.QButtonGroup()
self.rBBackupFromExt = QtGui.QRadioButton()
bGBackupFromIntExt.addButton (self.rBBackupFromExt)
layout.addWidget(self.rBBackupFromExt)
self.rBBackupFromInt = QtGui.QRadioButton()
bGBackupFromIntExt.addButton (self.rBBackupFromInt)
layout.addWidget(self.rBBackupFromInt)
gBBackupToIntExt = QtGui.QGroupBox()
layout.addWidget(gBBackupToIntExt)
bGBackupToIntExt = QtGui.QButtonGroup()
self.rBBackupToExt = QtGui.QRadioButton()
bGBackupToIntExt.addButton (self.rBBackupToExt)
layout.addWidget(self.rBBackupToExt)
self.rBBackupToInt = QtGui.QRadioButton()
bGBackupToIntExt.addButton (self.rBBackupToInt)
layout.addWidget(self.rBBackupToInt)
你知道我的错误在哪里,我必须改变什么吗?