I have a simple if else statement, but i have a question why is the if condition is not working even though it is true, but when the else is true it works fine.
Can somebody tell me why my if condition is not working even if it is true?
self.comboBoxCourse.currentIndexChanged.connect(self.courseChoosed)
This is the if else statement:
def courseChoosed(self):
if self.comboBoxCourse.currentIndex() == 0:
self.pushButton_2.clicked.connect(self.courseSTEM)
print("Your Current course is STEM")
elif self.comboBoxCourse.currentIndex() == 1:
self.pushButton_2.clicked.connect(self.courseICT)
print('Your current course is ICT')
print(self.comboBoxCourse.currentIndex())
If I choose STEM which is Index == 0: which is true, it is showing the print message, I don't know why but the button is not working.
Result of else statement if the combobox is ==1: and the button works really fine.
Can someone tell me why is the button function in the if statement doesn't work even if it is true?


Aucun commentaire:
Enregistrer un commentaire