Thread.started signal - can it be edited to pass a variable?
-
Hello,
i used the signal the thread emits when it started to connect it to a function like this:
self.thread.started.connect(self.worker.run)
now, i would need to pass a variable to run(). its my understanding that this should be done with the signal, but started is a preexisting signal. How am I supposed to do this?
is there a way to edit/overwrite the started signal?
should this started signal start a intermediate function that starts a new signal that has the structure I need?what is the proper way of doing it?
Thank you!
-
@Igor86 said in Thread.started signal - can it be edited to pass a variable?:
i would need to pass a variable to run()
Why?
You can pass that variable before starting thread (either as constructor parameter or a getter method).If you really need to pass a parameter to run use a lambda.
-
@jsulm said in Thread.started signal - can it be edited to pass a variable?:
@Igor86 said in Thread.started signal - can it be edited to pass a variable?:
i would need to pass a variable to run()
Why?
You can pass that variable before starting thread (either as constructor parameter or a getter method).If you really need to pass a parameter to run use a lambda.
uoooohhhh thank you! didnt know I can pass values before i start the thread.. this is a gamechanger..
thank you very much!