Search code examples
pythonpyqtsignals-slots

PyQt Signals and slots


I've just started programming in PyQt and I'm following "Rapid GUI programming in Python and Qt" by Mark Summerfield. Before this I did some programming in C++ and Qt and the author of the book which I followed recommended the use of signals and slots, and I too like the use of signals and slots over "on_widgetName_signalName" methods. But I was surprised to see that the author of "Rapid GUI programming in Python and Qt" uses "on_widgetName_signalName" over signals and slots wherever he created GUI using designer, and I was even more surprised to see that the examples which comes bundled with pyqt installer doing the same.

Is there a reason to use "on_widgetName_signalName" method over signals and slots in PyQt or its just that these people have not updated their code for long?


Solution

  • Basicly when you use on_widget_signal() it auto connects "widget"'s signals to that function (applies to C++)

    Check QMetaObject::connectSlotsByName