def nextQuestion(self): self.listWidget.disconnect() try: a = self.aList[self.currentQ] i = QListWidgetItem(self.listWidget) i.qId = self.qList[self.currentQ][0] i.qN = self.currentQ i.setText(self.qList[self.currentQ][1]) i.setCheckState(1 + a.a) i.setFlags(i.flags() | 256) # tristate except: pass self.currentQ += 1 try: self.label_question.setText(self.qList[self.currentQ][1]) except: self.label_question.setText("Plus aucune question") self.listWidget.itemChanged.connect(self.updateAnswer) self.updateAgents()