Answer the question
In order to leave comments, you need to log in
How to call self of parent class?
I am working with PyQT5 module with Python.
There is a class Example which is inherited from QMainWindow.
on button click I want to activate streams and display text in qlineedit (hereinafter self.text_log).
Inside the Example class (this is our qt window), I create the MyThread class. which inherits from Thread and override the run method.
How can I access self.text_log from the Example class in the MyThread class?
Answer the question
In order to leave comments, you need to log in
Wrong terminology. Example is not the parent of MyThread.
Pass a reference to an instance of Example (or to the desired field) as a parameter to the MyThread constructor and store it as an instance variable of the MyThread class. But keep in mind that it's not guaranteed that you can access QT controls directly from another thread.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question