[PyQt] QThread join???

Mark Summerfield mark at qtrac.eu
Fri May 4 12:31:32 BST 2007


On Fri 4-May-07, Pradnyesh Sawant wrote:
> Hello
> I have something like the foll scenario:
>
> class A(QThread):
>     def __init__(self):
>         QThread.__init__(self)
>     def run(self):
>         # do something
>         pass
> class B:
>      def __init__(self):
>          a = A()
>          a.start()
>          # a.join()               # how do i do this???
>
> Basically i want class B to "wait" till thread in class A has run
> completely. But it seems QThread does not have a ".join" method. How
> do i achieve the above?
>
> Any suggestions would be encouraging!

QThread.wait() should do what you want, i.e.,


 class B:
      def __init__(self):
          a = A()
          a.start()
          a.wait() # blocks until a's run() method has finished.


-- 
Mark Summerfield, Qtrac Ltd., www.qtrac.eu



More information about the PyQt mailing list