I am trying to make a GUI using PyQt5. I have a couple of buttons say 4 which call the same function. A click on a button calls the same function to plot the data associated with each button.
radiobutton1.clicked.connect(self.fun)
radiobutton2.clicked.connect(self.fun)
radiobutton3.clicked.connect(self.fun)
radiobutton4.clicked.connect(self.fun)
Since each line of code is the same except the name of the button, is there a way instead of writing almost the same code four times, I use a for loop to generate the code?