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]

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


Over 10,000 developers have bought Create GUI Applications with Python & Qt!
Create GUI Applications with Python & Qt5
Take a look

Downloadable ebook (PDF, ePub) & Complete Source code

Also available from Leanpub and Amazon Paperback

[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
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.