I have a short little TCL program I wrote (it uses "wish") to prompt
the user for a string. It the spits the string out to stdout, so I can
use it in a shell script or on a command line.
Stupid example:
ls `xinput "Dialog Box" "Filename to list?" "File:"`
My wish program ("xinput") will run and prompt the user for some text.
The window looks kind of like this:
---------------------
[] Dialog Box [][][]
---------------------
| Filename to list? |
| File: [_________] |
---------------------
When they press [Enter], the "ls" command is run with their text as argument(s)
What I want to do right NOW is to prompt for a password.
Because of this, I DON'T want the plaintext to be echoed in the text input
widget, of course! :)
I'm very, very weak with tcl/tk (I spent hours and hours and hours over
a year ago and ended up with this very simple program :) ), and was wondering
if anyone knew if there was a built-in "password" input widget, or some
other 'thing' I can call to do this.
My current code is below.
Thanks!
-bill!
#!/bin/sh
# the next line restarts using wish \
exec wish8.0 "$0" "$@" -geometry +500+500 -name $1
# xinput
# Asks for a username and echos it to stdout
# Usage: xinput window-manager-title window-text-(large) label-text-(small)
# by Bill Kendrick
# [EMAIL PROTECTED]
# Sept. 4, 1999 - Sept. 4, 1999
# Place icon, label, and text-entry field into window:
label .icon -bitmap questhead
label .title -text [lindex $argv 1] -font {Times 18}
label .label -text [lindex $argv 2] -font {Times 12}
entry .input
global .input
# Draw the window:
pack .icon
pack .title
pack .label -side left -fill both -expand yes
pack .input -side right -fill both -expand yes
#pack .ok
# Make the [Return] key call our procedure below:
bind .input <Return> "doit"
# Make the cursor default to the text-entry field:
focus .input
# Write the text-entry field's contents to stdout and quit:
proc doit {} {
puts [.input get]
destroy .
}