or: buttons = [QPushButton("button %d" % i) for i in range(12)] for button in buttons: button.clicked.connect(lambda button=button: do_something(button))
On Tue, Jul 20, 2010 at 8:57 AM, Doug Bell <do...@bellz.org> wrote: > starglider develop wrote: >> Hi, >> I have a form with 12 QPushButtons and need to connect the signals to the >> corresponding button pressed without have to use the usual >> self.connect(obj,SIGNAL(),self.function), because I don't khow many buttons >> where made. > > Read the documentation for QButtonGroup. Set it to non-exclusive, and > it can signal if any button is pressed. > > Doug > _______________________________________________ > PyQt mailing list p...@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt