人们推荐哪种语言作为简单的GUI,可以用作在Cygwin上运行的脚本的输入?

时间:2022-08-26 23:18:59

I need a simple window with three input boxes and three labels (login name, password, and server node) and a button to execute the script. I do not want any third party programs that need to be installed on Windows. If it can be installed on Cygwin that would be great.

我需要一个带有三个输入框和三个标签(登录名,密码和服务器节点)的简单窗口以及一个执行脚本的按钮。我不希望任何需要在Windows上安装的第三方程序。如果它可以安装在Cygwin上那将是很棒的。

2 个解决方案

#1


2  

You might want to look at Tcl/Tk and the notion of starkits and starpacks. With the latter you can create a single-file windows executable so your end users wouldn't have to install anything other than this program.

你可能想看看Tcl / Tk以及starkits和starpacks的概念。使用后者,您可以创建单个文件的Windows可执行文件,这样您的最终用户就不必安装除此程序之外的任何内容。

By using tk 8.5 you'll also get the benefit of native windows widgets so the GUI can look very professional.

通过使用tk 8.5,您还可以获得本机Windows小部件的好处,因此GUI看起来非常专业。

The code would look something like this:

代码看起来像这样:

package require Tk 8.5
proc main {} {
    ttk::frame .f
    ttk::label .l1 -text "Username:" -anchor e
    ttk::label .l2 -text "Password:" -anchor e
    ttk::label .l3 -text "Server:" -anchor e
    ttk::entry .e1 -textvariable data(username)
    ttk::entry .e2 -textvariable data(password) -show *
    ttk::entry .e3 -textvariable data(server)
    ttk::button .b1 -text "Submit" -command run

    grid .l1 .e1 -sticky ew -in .f -padx 4
    grid .l2 .e2 -sticky ew -in .f -padx 4
    grid .l3 .e3 -sticky ew -in .f -padx 4
    grid x   .b1 -sticky e -row 4 -in .f -padx 4 -pady 4

    grid rowconfigure .f 3 -weight 1
    grid columnconfigure .f 1 -weight 1

    pack .f -side top -fill both -expand true

    focus .e1
}

proc run {} {
    global data
    puts "username: $data(username)"
    puts "password: $data(password)"
    puts "server: $data(server)"
}

main

#2


1  

A lot of people used to use TCL/TK for this kind of thing (in cygwin).

很多人习惯使用TCL / TK来做这种事情(在cygwin中)。

If it's just for Windows, then any .NET language using Winforms would be simple to use (won't need to distribute .NET unless you have older boxes).

如果它只适用于Windows,那么使用Winforms的任何.NET语言都很简单(除非你有旧盒子,否则不需要分发.NET)。

#1


2  

You might want to look at Tcl/Tk and the notion of starkits and starpacks. With the latter you can create a single-file windows executable so your end users wouldn't have to install anything other than this program.

你可能想看看Tcl / Tk以及starkits和starpacks的概念。使用后者,您可以创建单个文件的Windows可执行文件,这样您的最终用户就不必安装除此程序之外的任何内容。

By using tk 8.5 you'll also get the benefit of native windows widgets so the GUI can look very professional.

通过使用tk 8.5,您还可以获得本机Windows小部件的好处,因此GUI看起来非常专业。

The code would look something like this:

代码看起来像这样:

package require Tk 8.5
proc main {} {
    ttk::frame .f
    ttk::label .l1 -text "Username:" -anchor e
    ttk::label .l2 -text "Password:" -anchor e
    ttk::label .l3 -text "Server:" -anchor e
    ttk::entry .e1 -textvariable data(username)
    ttk::entry .e2 -textvariable data(password) -show *
    ttk::entry .e3 -textvariable data(server)
    ttk::button .b1 -text "Submit" -command run

    grid .l1 .e1 -sticky ew -in .f -padx 4
    grid .l2 .e2 -sticky ew -in .f -padx 4
    grid .l3 .e3 -sticky ew -in .f -padx 4
    grid x   .b1 -sticky e -row 4 -in .f -padx 4 -pady 4

    grid rowconfigure .f 3 -weight 1
    grid columnconfigure .f 1 -weight 1

    pack .f -side top -fill both -expand true

    focus .e1
}

proc run {} {
    global data
    puts "username: $data(username)"
    puts "password: $data(password)"
    puts "server: $data(server)"
}

main

#2


1  

A lot of people used to use TCL/TK for this kind of thing (in cygwin).

很多人习惯使用TCL / TK来做这种事情(在cygwin中)。

If it's just for Windows, then any .NET language using Winforms would be simple to use (won't need to distribute .NET unless you have older boxes).

如果它只适用于Windows,那么使用Winforms的任何.NET语言都很简单(除非你有旧盒子,否则不需要分发.NET)。