Search code examples
pythonxterm

Sending commands from one xterm window to another with Python


So I have a Python app that starts different xterm windows and in one window after the operation is finished it asks the user "Do you want to use these settings? y/n". How can I send y to that xterm window, so that the user doesn't needs to type anything. Thanks


Solution

  • If you are on linux (kde) and you just want to control the xterms by sending commands between them, you could try using dcop:

    Otherwise you would need to actually use an inter-process communication (IPC) method between the two scripts as opposed to controlling the terminals:

    Or at a very very basic level, you could have one script wait on file output from the other. So once your first xterm finishes, it could write a file that the other script sees.

    These are all varying difficulties of solutions.