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

发布于 2024-07-09 10:46:03 字数 113 浏览 7 评论 0原文

我需要一个简单的窗口,其中包含三个输入框和三个标签(登录名、密码和服务器节点)以及一个用于执行脚本的按钮。 我不想要任何需要在 Windows 上安装的第三方程序。 如果能安装在 Cygwin 上那就太好了。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦行七里 2024-07-16 10:46:04

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

如果它仅适用于 Windows,那么任何使用 Winforms 的 .NET 语言都将很容易使用(不需要分发 .NET,除非您有较旧的机器)。

A lot of people used to use TCL/TK for this kind of thing (in 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).

江南烟雨〆相思醉 2024-07-16 10:46:03

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

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

代码看起来像这样:

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

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.

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文