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

2024-04-20 07:36:12 发布

您现在位置:Python中文网/ 问答频道 /正文

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

enter image description here

像gnome terminal或xterm这样的控制台程序,每一个新命令都会不断滚动屏幕,特别是当结果只有几十行时,我觉得这很烦人。你知道吗

我想可视化的命令和结果在同一时间,就像一个浏览器在地址栏中输入一个网址,并获得作为结果的网站。你知道吗

谢谢你。你知道吗


Tags: 文本命令程序区域软件屏幕部件linux
1条回答
网友
1楼 · 发布于 2024-04-20 07:36:12

好吧,这样的事情在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
}

相关问题 更多 >