所以我开始乱用python3的gi模块,并且遇到了Vte.Terminal的问题。我查看了其他帖子,并且已经将其用于执行shell脚本:
def initWidgets(self):
self.terminal = Vte.Terminal()
self.layout.pack_start(self.terminal, True, True, 0)
self.terminal.fork_command_full(
Vte.PtyFlags.DEFAULT, #default is fine
os.environ['HOME'], #where to start the command?
["/bin/sh"], #where is the emulator?
[], #it's ok to leave this list empty
GLib.SpawnFlags.DO_NOT_REAP_CHILD,
None, #at least None is required
None,
)
command = '"/home/User/Dropbox/GTK+ 3/testScript.sh"'
length = len(command)
self.terminal.feed_child(command, length)
但是我收到了这个错误:
AttributeError: 'Terminal' object has no attribute 'fork_command_full'
我意识到这意味着函数'fork_command_full'已被删除,但是在文档中我没有找到替换或替代方法。任何帮助,将不胜感激。
P.S。这就是我的testScript.sh的样子:
#!/bin/bash
echo Working!