speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with "end" callback in Python


From: James Simmons
Subject: Problems with "end" callback in Python
Date: Thu, 17 Apr 2008 15:13:36 -0500

Hynek,

I have been looking for an alternative to using gobject.timeout_add() in 
my program and hit on the idea of trying threads in Python.  I found out 
that pygtk is not thread safe, hence you need to use gtk.threads_enter() 
and gtk.threads_leave() before and after you execute any GTK code from 
another thread.  It sounds like thread support in a pygtk application is 
problematic.  It would help if I could avoid it.

What would make my life simpler would be a way to invoke speech 
dispatcher on a word and have the function not return until the word has 
finished being spoken.  That way I would not have to deal with callbacks 
and multiple threads.  Another thing that might work is invoking speech 
dispatcher on an entire page and having a callback called at the end of 
each word.  That way the calbacks could drive the highlighting of the 
words, rather than having the logic that highlights the words drive the 
speaking.  That might actually give more natural sounding results, and 
would eliminate the need for gobject.timeout_add().

If you have any thoughts on this I'd like to hear them.

James Simmons


Hynek Hanke wrote:

>
> Hello James,
>
> I have tried to run the code you've sent and I can reliably reproduce 
> the issue. I believe it has something to do with the way how you call 
> speechd.client.speak() from inside the gtk loop, because outside of 
> it, everything works normally (even in your application).






reply via email to

[Prev in Thread] Current Thread [Next in Thread]