import gtk
import vte

def on_contents_changed(term):
    pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 480, 320)
    term.set_background_image(pixbuf)

win = gtk.Window()
win.set_default_size(480, 320)
win.connect('destroy', lambda *x: gtk.main_quit())

term = vte.Terminal()
term.connect('contents-changed', on_contents_changed)

win.add(term)

win.show_all()

term.fork_command()

gtk.main()
