mercredi 18 décembre 2019

select one checkbox and uncheck another checkbox which is checked

While running code get this Error Message: what i am trying to do is select any checkbox, but when clicking to any other checkbox the first checkbox remain clicked only so i want i can only select one checkbox at a time not to or there like radio button checkbox.

Traceback (most recent call last):
File "C:/Projects/SmartTesterPython/PidStop.py", line 457, in <module>
ui.setupUi(Dialog)
File "C:/Projects/SmartTesterPython/PidStop.py", line 186, in setupUi
self.printAll_checkBox.stateChanged.connect(self.onStateChange)
TypeError: connect() failed between stateChanged(int) and onStateChange()

code goes here:

self.printAll_checkBox.stateChanged.connect(self.onStateChange)
self.printFail_checkBox.stateChanged.connect(self.onStateChange)

@pyqtSlot(int)
def onStateChange(self, state):
    if state == Qt.Checked:
    if self.sender() == self.printAll_checkBox:
       self.printFail_checkBox.setChecked(False)
       self.printNothing_checkBox.setChecked(False)
       self.printPassFail_checkBox.setChecked(False)
    elif self.sender() == self.printFail_checkBox:
       self.printAll_checkBox.setChecked(False)
       self.printNothing_checkBox.setChecked(False)
       self.printPassFail_checkBox.setChecked(False)



Aucun commentaire:

Enregistrer un commentaire