寻找一个GUI应用程序来输入linux命令

时间:2013-08-28 18:48:01

标签: python linux user-interface tcl command-line-interface

我正在寻找一个GUI控制台,我可以在条目小部件中输入linux命令,结果将在文本区域小部件中输出。有这样的软件吗?像这样:

enter image description here

像gnome-terminal或xterm这样的控制台程序,屏幕会随着每个新命令一直滚动,当结果有几十行时我发现这很烦人。

我想同时可视化命令和结果,就像浏览器在地址栏中输入网址并获取网站一样。

谢谢。

1 个答案:

答案 0 :(得分:8)

好吧,这样的事情很容易在Tcl中实现。

package require Tk 8.5
grid [ttk::entry .input -textvariable input] -sticky nesw
grid [text .text] -sticky nesw
grid rowconfigure . .text -weight 1
grid columnconfigure . .text -weight 1
bind .input <Return> execute
bind .input <Up> {histwalk -1}
bind .input <Down> {histwalk 1}

proc execute {} {
    history add $::input
    set ::eventcnt 0
    .text delete 1.0 end
    catch {exec /bin/bash -c $::input} res
    .text insert 1.0 $res
    .input selection range 0 end
}

set eventcnt 0
proc histwalk i {
   incr ::eventcnt $i
   set ::input [history event $::eventcnt]
   .input selection range 0 end
}