Command line and GUI tools : need a single threading solution
Phil Thompson
phil at riverbankcomputing.co.uk
Mon Jan 10 07:30:04 EST 2005
> I have a collection of multi-threaded command line tools which I want wrap
> a
> PyQt gui around. I'm using queues to route messages from the command line
> tools to the PyQt gui. The command line tools use python threads to do
> their work. The gui uses a QThread object to read incoming messages.
>
> This does not work consistently - and I've since read that mixing python
> threads and QThreads is a bad idea. The command line tools work well
> using
> python threads.
How well mixing the two threading APIs works depends on version numbers. A
PyQt generated with SIP v4.x (rather than SIP v3.x) with Python v2.4
should be Ok.
> I don't want to maintain two copies of the tools - one for command line
> and
> another for the PyQt version.
>
> I'm thinking it may be possible to modify the command line tools to use qt
> threads instead of native python threads. Is this the way to go? Are
> there other options?
Using QThreads only should work - just tell the QApplication ctor that you
have a console application.
Phil
More information about the Python-list
mailing list