from PyQt5 import QtWidgets
import sys
def on_clicked_1():
for x in list_of_radiobtn:
print(x.isChecked)
x.setChecked(True)
x.update()
x.setChecked(False)
print(x.isChecked())
x.hide()
def on_clicked_2():
for x in list_of_radiobtn:
print(x.isChecked())
x.setChecked(False)
print(x.isChecked)
x.show()
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QWidget()
window.setWindowTitle("Класс QButtonGroup")
window.resize(300, 80)
list_of_radiobtn = []
radio1 = QtWidgets.QRadioButton("Один")
radio2 = QtWidgets.QRadioButton("Два")
radio3 = QtWidgets.QRadioButton("Три")
radio4 = QtWidgets.QRadioButton("Четыре")
list_of_radiobtn.append(radio1)
list_of_radiobtn.append(radio2)
list_of_radiobtn.append(radio3)
list_of_radiobtn.append(radio4)
btn_1 = QtWidgets.QPushButton('Скрыть', window)
btn_1.move(200, 20)
btn_1.clicked.connect(on_clicked_1)
btn_2 = QtWidgets.QPushButton('Показать', window)
btn_2.move(200, 60)
btn_2.clicked.connect(on_clicked_2)
box = QtWidgets.QVBoxLayout()
box.addWidget(radio1)
box.addWidget(radio2)
box.addWidget(radio3)
box.addWidget(radio4)
window.setLayout(box)
window.show()
sys.exit(app.exec_())