On Fri, 21 Feb 2003 14:14:08 +0200, [EMAIL PROTECTED] (Yargo) wrote:

>Hi all,
>I have this little script that asks the user for UserName & password.
>
>I can't figure out where do I get the input.
>e.g. :
>UserName = yargo
>Password = q1w2e3

Here's an example:

#!/usr/bin/perl
use Tk;

my $MainWindow = MainWindow->new;
$MainWindow->title("Password Entry");

$MainWindow -> Label(-justify => 'left',
                     -text => "Name: ")
                    ->pack(-side => 'left',
                           -anchor => 'n');

my $entry = $MainWindow -> Entry(-selectborderwidth => 10)
                    ->pack(-side => 'top',
                           -anchor => 'n');

###############################################################

$MainWindow -> Label(-justify => 'left',
                     -text => "Password: ")
                     ->pack(-side => 'left',
                             -anchor => 'w');


my $entry1 = $MainWindow -> Entry(-selectborderwidth => 10,
                                  -show => "*")
                        ->pack(-side => 'left',
                              -anchor => 'e');


##############################################################
$MainWindow -> Button(-text => "SUBMIT",
                     -command => \&somesub)
             ->pack(-side => 'bottom',-anchor => 's');


$entry->bind('<Return>',[\&somesub]);
$entry->focus;
MainLoop;

sub somesub {
    $name = $entry -> get;
    $password = $entry1->get;
    print "name ->$name\n";
    print "password ->$password\n";
    $MainWindow -> destroy;
    }
    
    



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to