首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在GUI中通过终端输出

在GUI中通过终端输出
EN

Stack Overflow用户
提问于 2016-03-07 18:49:17
回答 1查看 76关注 0票数 0

我已经创建了一个在Linux终端中运行命令的GUI。

EXAMPLE=> -n 20 -id 15 -domain square(10,20) -dim 2 -o execution -format geo

此命令用于执行包的代码。当它执行时,一系列的输出将在Linux终端中进行。输出要么成功,要么生成输出,要么由于转储错误或错误参数而发生错误。

终端输出实例:

错误: matheval未能处理表达式。表达式语法可能不正确。这也可能是由错误的matheval安装引起的(表达式=1 -ori光纤(,,))。中止(核心倾弃)

另一个错误

错误:糟糕的争论!中止(核心倾弃)

我要做的是将此错误作为MessageBox返回到GUI中,并/或使用该错误更新GUI的底部状态栏。

我不熟悉wx和子流程模块,但到目前为止我的研究还没有找到解决方案。

我正在运行Python2.7并使用Tkinter。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-03-08 17:17:44

这似乎能把工作做完。

代码语言:javascript
复制
        # Create a string and pass variables 
        neper_exec = "neper -T -n %s -id %s -format %s -o %s -dim %s -domain %s " % (n, id, output_form, o, dim, domain)
        # Execute the subporcess using the variable
        p = subprocess.Popen(neper_exec, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # when shell is dropped Linux gives and error

感谢@BrianMcFarland提供关于子进程命令的指导。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35851571

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档