python - PySide: Returning a value from a slot -
the pyside documentation states slots can have return values, have yet figure out how make so.
i couldn't find usable code samples on this, i've added decorator docs suggest:
def testslot(self): print('testslot called') return 'return value return value return value'
and i'm trying capture return value this:
ret = foo.testsignal.emit()
but it's not working. test code, can find here, crashes this error output. appreciated!
edit: i've removed decorator, solves crashing issue, still doesn't return value want return.
running script give me this:
foo.testsignal.emit()
testslot called
true
i'm afraid think not possible. signals , slots loosely coupled together, emitting signal not directly call slot, , therefore cannot retrieve "its" return value.
this might clearer if think this:
you can connect 2 different slots (of e.g. 2 different classes), return different values, to 1 signal. of 2 return values supposed reach variable try assign?
what mean this: different, , allows return values via "invoking" method on metaobject system "name".
Comments
Post a Comment