Python Forum
[GTK] Virtual python shell with Vte.Pty.spawn_async()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[GTK] Virtual python shell with Vte.Pty.spawn_async()
#1
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.
Reply


Messages In This Thread
[GTK] Virtual python shell with Vte.Pty.spawn_async() - by jiri - Mar-11-2019, 09:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter Shell Terminal Or Shell Output sweetthdevil 5 13,230 Feb-03-2024, 02:51 PM
Last Post: Gribouillis
  [Tkinter] Display on gui instead of Python shell Justin 2 5,037 Mar-05-2017, 06:33 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020