Hi, in this image i want to enable start button when USB name appear in combo-Box and if the name does not appear the button should disabled automatically, Here is My Code.
def x(self):
if (self.comboBox_3.currentIndex() == -1):
self.pushButton_5.setEnabled(False)
else:
self.pushButton_5.setEnabled(True)
You must use the currentIndexChanged signal to evaluate that logic:
# __init__ method
# ...
self.comboBox_3.currentIndexChanged[int].connect(self.on_currentIndexChanged)
def on_currentIndexChanged(self, index):
self.pushButton_5.setEnabled(index != -1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.