Hi I have a GUI with 26 QPushButtons named A to Z, using uicload I load into my Main class
is there any way to loop over them to end up with something
self.A.clicked.connect(self.foo(A))
# ..
self.Z.clicked.connect(self.foo(Z))
tried different ways but I end up always with either a syntax error or a
AttributeError: 'Main' object has no attribute 'button' (button = i for i in letters)
of course using:
just
self.A.clicked.connect(self.foo(A))
it works but not the loop (like for i in list, where list is names of the button A,B,C ... Z
for letter in "ABCDE":
getattr(self, letter).clicked.connect(lambda checked, letter=letter: foo(letter))
– Dinitrobenzene