Help with Tkinter and stdin input event binding

Diogo Bastos damrho at netcabo.pt
Mon Sep 25 10:10:26 EDT 2006


Hello,

I'm fairly used to working with Python but it's the first time I'm 
trying to use Tkinter so I'm running into a problem.

I'm using three python scripts with Tkinter GUIs and a fourth script 
that basically opens communication pipes with the three others. The idea 
is that the fourth script works as a communication intermediary between 
the others. The problem is that I can't make the Tkinter GUIs respond to 
stdin events because the toplevel mainloop isn't under my control, I 
have no idea how to do this.

Here's the main idea simplified.

Script 1 is a Tkinter GUI.
Script 2 uses os.forkpty() to get the child's pseudo-terminal descriptor.

Now if in Script 1 I use <print "Here I Am!"> I can get that input in 
Script 2 using simply the os.read() method on the pseudo-terminal 
descriptor. The problem is that when I use os.write() on that 
descriptor, there's no way I can get the input on Script 1 because I 
have no control whatsoever of the program's main loop. Is there any way 
around this, either by adding some sort of stdin input event binding or 
something similar?

Thanks in advance



More information about the Python-list mailing list