Interface with C

Ben Pearson brp13 at yahoo.com
Wed Sep 14 13:34:45 EDT 2005


I have a program that is developed in C, that has a simple text 
interface. I would like to use the same program, but with a GUI. I 
would like to use Python to interface with it, so that Python will 
simply read and write the code that would be used from a normal user, 
but using a TK GUI. For example, in the C program, if you type 0, it 
will send a ping. I would like to build a program that will run the C 
program, simply inputing the values that the Text interface would 
use, but with the graphical interface. EI, the following should work.

-----------
|   Ping  |
-----------

When this button is hit, it will send a code of 0 to the C program. 
Interfacing directly would cause lots of problems, especially whereas 
we would like to continue the source of the 2 programs, because 
sometimes we have to remotely acess our system, and a text interface 
is much better for that than a GUI, but the GUI would be able to give 
more functionality. I would prefer a simple interface, perhaps 
something like this. BTW, gui.py is the python code, and mcp is the 
name of the program.

./mcp | python gui.py

I've forgotten the correct naming to this, but, that's what I would 
want, or perhaps it would need to be reversed. Is there a way to do 
this with Python, to be able to read the output of the mcp program, 
and to send data to it, as if it were just a person at the computer 
converting? Thanks!






More information about the Python-list mailing list