import sys
from PyQt4 import QtCore, QtGui
class Class1(QtGui.QMainWindow):
def __init__(self):
super(Class1, self).__init__()
self.func()
def func(self):
r0=QtGui.QRadioButton("0",self)
r1=QtGui.QRadioButton("1",self)
ra=QtGui.QRadioButton("a",self)
rb=QtGui.QRadioButton("b",self)
r0.move(100,100)
r1.move(400,100)
ra.move(100,400)
rb.move(400,400)
number_layout=QtGui.QButtonGroup()
letter_layout=QtGui.QButtonGroup()
number_layout.addButton(r0)
number_layout.addButton(r1)
letter_layout.addButton(ra)
letter_layout.addButton(rb)
layout=QtGui.QHBoxLayout(self)
self.show()
def main():
app = QtGui.QApplication(sys.argv)
mw = Class1()
mw.show()
sys.exit(app.exec_())
if __name__=='__main__':
main()
我正在尝试对R0进行R0,RB IE进行分组,当检查R0时,R1应不受控制,对RA或RB状态没有影响。我怎样才能做到这一点?该代码表明了我到目前为止所尝试的内容。