python - How to uncheck a checked radio buttons in pyqt4 -
im making quiz , after next button pressed want the radio buttons unchecked isnt happening. here put radio buttons.
self.answers = qtgui.qbuttongroup(self) self.correctanswer = qradiobutton() self.incorrectans1 = qradiobutton() self.incorrectans2 = qradiobutton() self.incorrectans3 = qradiobutton() self.answers.addbutton(self.correctanswer) self.answers.addbutton(self.incorrectans1) self.answers.addbutton(self.incorrectans2) self.answers.addbutton(self.incorrectans3) self.answers.buttonclicked.connect(self.questioncheck) self.correctanswer.setautoexclusive(true) self.incorrectans1.setautoexclusive(true) self.incorrectans2.setautoexclusive(true) self.incorrectans3.setautoexclusive(true)
here subroutine connected next button. , here try set radio buttons clear isnt happening. radio button still has previous choice last question.
def showquestions2(self): self.questionum.settext("question 2") self.correctanswer.setchecked(false) self.incorrectans1.setchecked(false) self.incorrectans2.setchecked(false) self.incorrectans3.setchecked(false) self.ismultichoicebutton.clicked.connect(self.showquestions3)
could tell me im going wrong? thanks
def showquestions2(self): self.group.setexclusive(false) self.questionum.settext("question 2") self.correctanswer.setchecked(false) self.incorrectans1.setchecked(false) self.incorrectans2.setchecked(false) self.incorrectans3.setchecked(false) self.ismultichoicebutton.clicked.connect(self.showquestions3) self.group.setexclusive(true)
try code further refer link
Comments
Post a Comment