[pygtk] Using python vte
Edward A Robinson
earobinson at ubuntu.com
Wed Sep 5 05:26:06 WST 2007
Him Im trying to use python vte to create a terminal and issue it
commands in real time
I have tried to use this code
#!/usr/bin/env python
import os
import gtk
import vte
import time
from subprocess import Popen, PIPE
def show_callback(terminal):
terminal.feed_child('cd /\n')
terminal.feed_child('whoami\n')
terminal.feed_child('echo test\n')
for ii in range (10):
terminal.feed_child('echo ' + str(ii + 1) + '\n')
time.sleep(1)
def write(terminal, text):
x, y = terminal.get_cursor_position()
terminal.feed(text + '\n', len(text) + 1)
window = gtk.Window()
window.connect('destroy', lambda w: gtk.main_quit())
terminal = vte.Terminal()
terminal.connect("show", show_callback)
child_pid = terminal.fork_command()
#write(terminal, '1234567890')
window.add(terminal)
window.show_all()
gtk.main()
But instead of printing it out in real time it waits 10 seconds then
prints it, any feedback would be great. Thanks.
--
Edward A Robinson
More information about the pygtk
mailing list