In this sample of code:
from PyQt4.QtGui import QDialog, QPushButton, QRadioButton, QHBoxLayout, QApplication, QButtonGroup
import sys
class Form(QDialog):
    def __init__(self, parent=None):
        super(Form, self).__init__(parent=None)
        button = QPushButton('Button')
        self.radiobutton1 = QRadioButton('1')
        self.radiobutton2 = QRadioButton('2')
        #self.group = QButtonGroup()
        #self.group.addButton(self.radiobutton1)
        #self.group.addButton(self.radiobutton2)       
        #self.group.setExclusive(False)
        layout = QHBoxLayout()
        layout.addWidget(button)
        layout.addWidget(self.radiobutton1)
        layout.addWidget(self.radiobutton2)
        self.setLayout(layout)
        button.clicked.connect(self.my_method)
    def my_method(self):
        self.radiobutton1.setChecked(False)
        self.radiobutton2.setChecked(False)
app = QApplication(sys.argv)
form = Form()
form.show()
app.exec_()
When the button clicked I expect the selected radioButton to be unchecked, but that never happens. If I uncomment the comment lines and run the code, then I can uncheck radioButtons. But another problem occurs. Because the group is not exclusive, I can set both radioButtons checked something that must not happens.
What should I do to be able to unckeck the buttons while only one button at a time can be selected?