'setChecked multiple push buttons with for loop in python
Good day everyone, I am designing an interface in python with pyqt5. I tried all kinds of ways to check the buttons. I tried to pass with for loop but I couldn't find a solution. How can I get rid of code line duplication as seen below. How can I do it in one line with for loop. Thank you very much, I wish you have good day.
def getAllItems(self):
self.pushButton_1.setChecked(True)
self.pushButton_2.setChecked(True)
self.pushButton_3.setChecked(True)
self.pushButton_4.setChecked(True)
self.pushButton_5.setChecked(True)
self.pushButton_6.setChecked(True)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
