views:

178

answers:

2

Hello fellow programmers,

I am creating a GUI program in Python/PyQT and would like to know how I can connect an event which happens in a child object to the parent?

For example, if someone clicks a 'Submit' button, how would i trigger something to happen in the parent object (lets say update a QLabel on the parent)

Any help would be greatly appreciated

L

+4  A: 

It is done like in C++ Qt by connecting signals to slots, you will find all the information on this page (and here for the old way).

RedGlyph
A: 

You must connect these methods every time you set new parent (and remove old connections!!) http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qobject.html#connect (If widget parent change and You still wont that new parent to recive signals)

But if your layout is static just give good names for your widgets. Then connect each signal to callable (any python function) and that function will change QLable. In this case relation parent children change nothing since you refer to widgets by names not relations.

przemo_li