0

I have a window there are radio buttons and after change one of them I wanna click button and change all window.Not on the new window

I could not find the answer.

# ...
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)
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
J.Doe
  • 21
  • 1
  • 3
  • What is changing the whole window? Change the color of each widget that is in the window? Change all the icons?, etc. Your question is unclear, be specific and point out that things you want to change. – eyllanesc Jun 21 '19 at 15:49
  • I will give an example. First ı have some radio buttons and a button. When I click button ı wanna see Qline edit some other buttons and some other radio buttons – J.Doe Jun 21 '19 at 16:12
  • Okay this can be done using stacked widgets If I am understanding what you are saying here (see my other comment below) – Dennis Jensen Jun 21 '19 at 16:23
  • @J.Doe I have posted an example of something similar to this in response to the "PyQt: How to switch widgets in QStackedWidget" that is now denoted at the top – Dennis Jensen Jun 21 '19 at 17:10

1 Answers1

0
def some_function(*args, **kwargs):
   change_entire_window()

button = QPushButton("Click me!")
button.clicked.connect(some_function)

Then when you click the button, it will trigger some_function

JohnkaS
  • 622
  • 8
  • 18
  • Note depending on exactly what this person is attempting to do this may be completely wrong. I concur with eyllanesc the asker needs to define exactly what they mean so that the proper answer an be produced. Further this is answer is extremely vague and I would go as far as saying Microsoft-ish in nature. – Dennis Jensen Jun 21 '19 at 16:04
  • If you want to give a quality answer you should follow the guidelines indicated in [answer] :-) – eyllanesc Jun 21 '19 at 16:06
  • change_entire_window() that is what ı mean how can ı do this can u give a simple example – J.Doe Jun 21 '19 at 16:15
  • @J.Doe by Entire Window do you mean you want to totally swap out your QMainWindow for another QMainWindow or are you needing to just change the current view presented by the Widget you are using? Note I can see reasons for the latter as I do this but not the former but it is the former you seemed to be implying. – Dennis Jensen Jun 21 '19 at 16:20
  • Ah i forgot that it's button.clicked.connect, my bad, edited. – JohnkaS Jun 21 '19 at 16:28
  • @DennisJensen accualy it does not matter for me both of them work. can u explain those. – J.Doe Jun 21 '19 at 16:38
  • @Bapo yes ı did that but then ı write this funk ```py def app(self): if self.r1.isChecked() : class Pencere1(): def __init__(self): super().__init__() self.setI() def setI(self): self.setWindowTitle("Addition Test") appp = QApplication([]) widgetx = Pencere() widgetx.show() appp.exec_() ``` and this is not working – J.Doe Jun 21 '19 at 16:39
  • @J.Doe I have posted an example of something similar to this in response to the "PyQt: How to switch widgets in QStackedWidget" that is now denoted at the top – Dennis Jensen Jun 21 '19 at 17:10