Command line and GUI tools : need a single threading solution
phil at riverbankcomputing.co.uk
Mon Jan 10 13:30:04 CET 2005
> I have a collection of multi-threaded command line tools which I want wrap
> 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
> 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
> 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.
More information about the Python-list