你怎么能ı 用按钮改变整个窗口

2024-05-23 23:07:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个窗口有单选按钮,改变其中一个后,我想点击按钮,改变所有窗口。不是在新窗口

我找不到答案

# ...
self.setWindowTitle("Test Your Math...")
r1 = QRadioButton("addition")
r2 = QRadioButton("extraction")
r3 = QRadioButton("multiplication")
r4 = QRadioButton("division")

h_box = QHBoxLayout()
h_box.addWidget(r1)
h_box.addWidget(r2)
h_box.addWidget(r3)
h_box.addWidget(r4)


v_box = QVBoxLayout()
v_box.addWidget(self.label_text)
v_box.addStretch()
v_box.addLayout(h_box)
self.setLayout(v_box)
v_box.addWidget(self.a)
changebutton = QPushButton()
changebutton.setIcon(QIcon("blabla"))
changebutton.setIconSize(QSize(65,65))
v_box.addWidget(changebutton)

Tags: 答案testselfboxyourmath按钮r2