Help with Tkinter and stdin input event binding

D

Diogo Bastos

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top