views:

121

answers:

2

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.

+1  A: 

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).

Lou Franco
+2  A: 

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
Bryan Oakley
Wow you did my work for me. Thanks! This question has led me too fltk and FLUID Which is fun to play around with but not very quick and dirty as I would like TCL/TK is what I want. Lou Franco answer was good but wow you wrote the code!
Paul
One of the things most people don't realize is just how incredibly simple it is to write a GUI in Tcl/Tk -- no IDE required.
Bryan Oakley