Unable to call function inside thread.finished()
Moved
Unsolved
Qt for Python
-
I want to pass func1 inside worker.finished() inside func2 which creates a thread.
class Parent(UI): def func1(self): self.button1.setEnabled(True) self.button2.setEnabled(False) def func2(self): self.worker = WorkerThread() self.worker.start() self.worker.finished.connect(Parent.func1(self)) # argument 1 has unexpected type 'NoneType' class WorkerThread(QThread): do_stuff
-
The file in which I'm trying to achieve it is derived from UI.py. main.py file which runs the program also derived from UI.py. I didn't inherit main class inside the parent class file but called the function through main.py file
I tried it. It doesn't work, throws error saying
AttributeError: 'mainClass' object has no attribute 'func1'
-
@qtDevOps
I don't know what you're saying. Your code shows aclass Parent
containing adef func1(self)
. That's how I answered. My line is a replacement for the line you show with# argument 1 has unexpected type 'NoneType'
. I don't know about anymainClass
.