Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for i in range(1,48):
- rb = "radioButton_" + str(i)
- self.rb.setChecked(False)
- from PyQt5 import Qt
- class Widget(Qt.QWidget):
- def __init__(self):
- super().__init__()
- main_layout = Qt.QVBoxLayout()
- for i in range(10):
- name = str(i)
- button = Qt.QRadioButton(name)
- button.setObjectName('radioButton_' + name)
- main_layout.addWidget(button)
- self.setLayout(main_layout)
- def do_all_enabled(self):
- for button in self.findChildren(Qt.QRadioButton):
- print(button.objectName())
- if button.objectName().startswith('radioButton_'):
- button.setEnabled(False)
- if __name__ == '__main__':
- app = Qt.QApplication([])
- w = Widget()
- w.do_all_enabled()
- w.show()
- app.exec()
Add Comment
Please, Sign In to add comment