Signal and Slot

Heads up! You've already completed this tutorial.

Scoodood | 2020-08-06 18:18:52 UTC | #1

Dear Martin,

I am just done watching the Signal, Slots & Events video and done reading the Signals and Slots chapter on your PySide2 ebook. The sample code below is from your video

python
self.windowTitleChanged.connect(self.onWindowTitleChange)

def onWindowTitleChange(self, s):   # <--- "s" ??
   print(s)

How do you know that the signal is also passing along a string variable s in this case? There are so many type of signals in Qt (pressed, released, drag, move....etc), how do we know each signal is passing along what-else when it is triggered? How do we find out?

Thanks


Impiastro_1 | 2020-08-07 15:59:20 UTC | #2

[quote="Scoodood, post:1, topic:394"] How do you know that the signal is also passing along a string variable s in this case? There are so many type of signals in Qt (pressed, released, drag, move…etc), how do we know each signal is passing along what-else when it is triggered? How do we find out? [/quote]

Create GUI Applications with Python & Qt5 by Martin Fitzpatrick — (PySide2 Edition) The hands-on guide to making apps with Python — Over 10,000 copies sold!

More info Get the book

You can find your answers here: https://doc.qt.io/qtforpython/PySide2/QtGui/QWindow.html?highlight=windowtitlechanged#PySide2.QtGui.PySide2.QtGui.QWindow.windowTitleChanged

I think that in this case the signal emits only one unicode parameter.

ROb


Create GUI Applications with Python & Qt6 by Martin Fitzpatrick — (PyQt6 Edition) The hands-on guide to making apps with Python — Over 10,000 copies sold!

More info Get the book

Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

Signal and Slot was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.