I have written a python code using the PyQt5 library to give a graphic to the application and would like the TimeEdit to be disabled/enabled when a CheckBox is clicked. That is, I would like when the CheckBox is checked TimeEdit to be enabled and when the CheckBox is not checked TimeEdit to be disabled.
I tried using this code which is executed first but the state of the TimeEdit does not change: def during(self): if self.checkBox_3.isChecked() == False: self.timeEdit.setEnabled(False) else: self.timeEdit.setEnabled(True)
Obviously at the beginning of the code I declared both the checkbox and the timeEdit
self.timeEdit.setGeometry(QtCore.QRect(20, 50, 93, 22)) self.timeEdit.setStyleSheet("background-color:rgb(255, 255, 255)") self.timeEdit.setObjectName("timeEdit") self.checkBox_3 = QtWidgets.QCheckBox(self.groupBox_4) self.checkBox_3.setGeometry(QtCore.QRect(10, 20, 110, 21)) self.checkBox_3.setObjectName("checkBox_3")
As a programming space I use Visual Studio Code
Aucun commentaire:
Enregistrer un commentaire