[PyQt] QThread, suggestions.

Brian Kelley kelley at eyesopen.com
Thu Jan 29 15:36:56 GMT 2009


I'm not sure why you would want to do this.  You could just set up a QTimer to poll the Process to see if it was completed.  The Qtimer func could then emit a finished signal.  You could poll every second or so.  You could even poll for percent complete if you have that information.

Much easier than using a thread.

Brian


On 1/29/09 10:34 AM, "Matt Smith" <melkor at orangepalantir.org> wrote:

It looks like I could just replace the QThread with a
multiprocess.Process except for the fact the QThread is a QObject which
uses signals and slots.

If I want to use the same techniques I would have to start a Process in
a QThread to get similar behavior; a signal when finished.  I suppose
the performance would be better if approached correctly.


thanks
mbs

On Thu, 2009-01-29 at 04:45 -0800, Brian Kelley wrote:
> If you happen to be using python 2.6, multiprocessing is your friend.
>
> http://docs.python.org/dev/library/multiprocessing.html
>
> It is very easy to use and because it runs in a separate process,
> there is no global interpreter lock.  Way, way, way better than
> threading for a lot of cases.  If it crashes, the main program doesn't
> go down.
>
> Brian
>
>
> On 1/27/09 2:01 PM, "Matt Smith" <melkor at orangepalantir.org> wrote:
>
>         In java they have the "SwingWorker" class and I thought of a
>         way to
>         implement something similar in python.  Here is the code:
>
>         http://paste.pocoo.org/show/101578/
>
>         I use this for starting long running processes.  Here is an
>         example of
>         how I have used it.
>
>         http://orangepalantir.org/files/threadworker.py
>
>         I was curious for some input, It seems threads are often
>         abused and I
>         don't want to be doing too much abusing.
>
>         mbs
>
>         _______________________________________________
>         PyQt mailing list    PyQt at riverbankcomputing.com
>         http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090129/3dfa54a5/attachment-0001.html


More information about the PyQt mailing list