[PyQt] Get Signals from all buttons in the form

2010-07-19 Thread starglider develop
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.

Yes I'm a newbe.

Thank you in advance.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Get Signals from all buttons in the form

2010-07-19 Thread Doug Bell
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 listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Get Signals from all buttons in the form

2010-07-19 Thread 机械唯物主义 : linjunhalida
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 listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt