- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 GTK 窗口中使用 VTE 模块来运行和显示 bash 脚本的结果。
adresse = self.champ.get_text()
pid = self.v.fork_command(None, ['/bin/bash', "./pluzz.sh", adresse])
if pid == None: #pseudocode
print "Finish"
如果存在 time.sleep 或循环,则子进程处于阻塞状态(不运行)。我能怎么做 ?谢谢
编辑:试过这个:
def check_pid(pid):
""" Check For the existence of a unix pid. """
try:
os.kill(pid, 0)
except OSError:
return False
else:
return True
问题是返回一次为 True,如果我写一个循环,bash 脚本就会阻塞。
最佳答案
我找到了一个解决方案:
def __init__(self):
a=0
self.fenetre = gtk.Window(gtk.WINDOW_TOPLEVEL)
[...]
self.v = vte.Terminal()
# self.v.connect ("child-exited", lambda term: gtk.main_quit()) # this is the line to change
self.v.connect ("child-exited", lambda term: self.copie(self, a)) # the redirection after the process is finish
self.v.show()
def download(self, a, donnees=None):
child_pid = self.v.fork_command(None, ['/bin/bash', "./pluzz.sh", adresse])
def copie(self, a, donnees=None):
print "FINISH"
关于Python Gtk2 & Vte 等待进程 Pid 完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23581690/
gtk+ 版本 2.24.8 vte 版本 0.28.2 我刚刚开始创建一个终端应用程序,但是,我在网上找到的示例 (5) 都没有有效的回滚功能。 vte 中的回滚是否有问题,或者是我没有看到的问题?
我正在开发一个使用 VTE 小部件的 GTK+ 3.0 应用程序,如何获取搜索正则表达式的出现次数或至少获取终端中的当前文本并进行处理? 我正在使用 VTE 2.91 和 Vala。 最佳答案 Vte
我正在尝试使用 VTE 模块来运行脚本 bash:我有几个错误,其中之一是: avconv version 9.11-6:9.11-2ubuntu2, Copyright (c) 2000-2013
我正在尝试使用 Vte 终端小部件来显示 python 脚本中的文本。 我没有设置工作目录或模拟器,我只是想要一个处理文本和 ansi 转义序列的空终端 我有这段代码,它可以在 python 2.7
我正在使用 vte.Terminal 在 python 中创建一个简单的终端。我想在终端背景中有一定程度的透明度,但 set_opacity 不起作用。但它适用于终结器和其他终端。 window.se
我正在尝试设置按键功能来指定 Shift+向上组合键以在 vte 终端窗口中向后滚动一行。这是我到目前为止所拥有的: case GDK_Up: if (event -> state & GDK
我在 GTK 窗口中使用 VTE 模块来运行和显示 bash 脚本的结果。 adresse = self.champ.get_text() pid = self.v.fo
我上周注意到了这一点。我在 ubuntu 15.04 上的所有代码都可以正常使用 Vte.Terminal().fork_command_full 还有 this documentation site
我计划执行以下操作: 使用一些小部件创建一个 PyGtk GUI(硬编码,无 Glade),并在屏幕底部放置某种 VTE(虚拟终端仿真器),我可以在其中操作这些小部件,例如更改它们的属性并调用它们来自
嘿,如何在 Python 中获取 VTE 小部件的当前工作目录?谢谢。 最佳答案 从 Mark 那里借用一个稍微更优雅的方法: import vte import os v = vte.Termina
这是我的第一篇文章。我每天在 Stackoverflow 上阅读很多主题,我很高兴能在那里找到一些帮助。今天轮到我提问了,因为我没有找到满足我需求的解决方案。 我想在我正在编写的应用程序中有一个终端;
我喜欢将终端连接到我的 nautilus 文件管理器的想法。 有一个名为 nautilus-terminal 的软件包可以执行此操作。 如果我尝试通过 sudo apt-get install nau
我正在构建一个选项卡式 python 终端来管理多个 ssh 连接(如 superputty 或 windows 上的 putty 管理器),所以我使用 feed_child 向终端发送命令,但有一个
我正在使用 Python + Gtk3 中的 Vte 编写应用程序。 我无法更改所有颜色。 例如,对于前景颜色,我试过这段代码,但是文本颜色没有改变: class Shell(Gtk.Box):
我是一名优秀的程序员,十分优秀!