[PyQt] Selective "processEvents"

r nbs.public at gmail.com
Fri Feb 4 17:05:12 GMT 2011


Is it possible to specify a list of events that are to be processed by
the Qt main loop?

I have an application where:
1. QTimer.singleShot(0, targetFunction) is used to schedule processing
of some deferred computations.
2. In some other part of the application I have a console emulator
which intercepts sys.stdout.write and redirects any text printed to it
to a QTextView component.

In order to update the QTextView contents I was using a processEvents
function in my sys.stdout.write implementation, but then I found it
interferes badly with the singleShot scheduling (basically it forces
the deferred computations when something is printed on the console).

I would like to be able to process only events relevant to the
QTextView updates but leave all other events (particularly that of
QTimer) untouched.

Another thing is that I'd prefer to avoid using threads - the main
code is hard enough even without them.

-r


More information about the PyQt mailing list