Dispatching a Win32 COM in the background?
Peter Hansen
peter at engcorp.com
Thu Jun 20 21:22:40 EDT 2002
"Steven M. Castellotti" wrote:
>
> Thanks a lot guys, your suggestions have worked perfectly!
>
> Just for the record, here's what the full implementation looks like.
Beautiful... thanks for the followup Steven. I especially like
your use of deferred imports to speed up initial program loading.
[...]
> if not(self.text_queue.empty()):
> text = self.text_queue.get()
> speech.Speak(text)
> time.sleep(.001)
Note that the time.sleep() as shown above is doing nothing
useful for you. I suspect you had it unindented but your
posting probably used tabs and spaces which makes it hard
to see properly on some readers.
The reason it does nothing useful is that Python will
automatically switch between different threads every so
often anyway, so the concept of giving up the CPU for
what amounts to a tiny fraction of a second is somewhat
unnecessary.
-Peter
More information about the Python-list
mailing list