Answer the question
In order to leave comments, you need to log in
PyQT 5. Python How to assign a function to all buttons?
There are a bunch of buttons with ObjectName radioButton_1, radioButton_2...RadioButton_48...
I can't figure out how to assign a function to all buttons at once?
for i in range(1,48):
rb = "radioButton_" + str(i)
self.rb.setChecked(False)
Answer the question
In order to leave comments, you need to log in
class MyApp:
def myFunc_1(self):
print('i am myFunc_1')
def myFunc_2(self):
print('i am myFunc_2')
def run(self):
for i in range(1, 3):
rb = 'myFunc_' + str(i)
getattr(self, rb)()
if __name__ == '__main__':
MyApp().run()
planc planc 's answer is good from a python point of view .
You need to use QGroupBox .
It groups your radiobuttons .
An example is here.
QGroupBox
QGroupBox has clicked and toggled signals to it and connect your function.
The next time they stop you on the street, invite them to talk about it what the site is based on)
Here is the message: "The resource at this IP address has been blocked by the decision of public authorities"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question