How to control gnome-terminal from Python scrypt?

Posted by user936401 on Ask Ubuntu See other posts from Ask Ubuntu or by user936401
Published on 2013-06-27T21:26:27Z Indexed on 2013/06/27 22:28 UTC
Read the original article Hit count: 195

I am developing an application in PyGtk, and would like to launch a gnome-terminal and output commands to it.

My user should then be able to modify the command, or maybe ignore using the up arrow ... etc.

I have been able to launch a terminal, but can't work out how to send commands.

This is how my application starts:

class App(Gtk.Window):

    def __init__(self):

        Gtk.Window.__init__(self)

        process=subprocess.Popen(["gnome-terminal", "--class=App", "--name=app"], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        response,error=process.communicate()

© Ask Ubuntu or respective owner

Related posts about command-line

Related posts about application-development