> On Tue, May 22, 2001 at 07:31:23PM +0100, David Given wrote:
> > I'm looking for a way to send user messages of some kind via the GTK
> > event loop. Basically, I have a running GTK application, and I want a
> > seperate application to be able to send it commands, which I'd like to
> > appear integrated into the event system. I know the functionality is
> > available in X; is there any easy way to do it using pygtk and/or
> > python-gnome?
>
> It depends on what you mean by "send commands".
>
> If want your application to respond to external input, you could use a pipe
> or a socket and gtk.input_add() to listen on it.
That's not really what I meant.
It's possible for two applications to communicate using the X server as an
intermediary. For example, this is how tk's send command works. I want one
program to be able to open the X server, find my GTK application, and send it
some arbitrary data; this should then arrive on the GDK event loop and get
passed somehow to my application --- probably via a callback. I don't want to
use sockets because they only work if the two programs are running on the same
machine. Since I know that the two programs are both using the same X server,
it ought to be easier to use that X server as the intermediary.
One of the things I want to use this for is to have an engine thread doing work
in the background. When the work is completed, it can send a message to the UI
thread telling it where the results are. The message arrives on the input queue
and is processed with all the other X events. Yes, I know I can do this with
semaphores and mutexes but that restricts me to using a thread in the same
process, which may not be the case. Besides, I don't know of any way of
integrating semaphore blocking into the GDK event loop.
And, of course, I want to do all this from Python.
Is this possible?
--
+- David Given --------McQ-+ "[SF is not about predicting the future.] We are
| Work: [EMAIL PROTECTED] | not prophets; in fact, if we were much worse at it,
| Play: [EMAIL PROTECTED] | we'd be economists." --- Stephen Dedman
+- http://www.cowlark.com -+
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk