Mar-11-2019, 09:35 PM
I would like add virtual python shell with Vte to my GTK3.0 python3 app and I am able to do this with spawn_sync() method, but this method is deprecated, so I would like to do it with preferred way with Vte.Pty.spawn_async(), but I dont understeand how .... I tried some parts of code, but with no luck. Pleas, give me someone some working code in python. For example, I tried variant like this:
import gi gi.require_version('Gtk', '3.0') gi.require_version('Vte', '2.91') from gi.repository import Gtk, Vte class TheWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="GTK3 IDE") self.box = Gtk.HBox(spacing=6) self.add(self.box) self.terminal = Vte.Terminal() self.terminal.pty_new_sync(Vte.PtyFlags.DEFAULT) self.pty = Vte.Pty() self.pty.new_sync(Vte.PtyFlags.DEFAULT, None) self.pty.spawn_async( None, ["/bin/python"], None, GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None, -1 ) self.terminal.set_pty(self.pty)Thanks a lot for any help.