in reply to Perl tk entry widget to get arguments for perl script.
When the $mw or MainLoop is destroyed, the script will continue right on after the MainLoop line, doing your bidding, reading your variables .
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow(); my $password = ''; my $entry = $mw->Entry( -show=>'*', -relief=>'ridge', -textvariable=>\$password )->pack; $entry->bind('<Return>',[\&somesub]); $entry->focus; MainLoop; sub somesub { $password = $entry->get; print "password ->$password\n"; $mw->destroy; } print "$password: you can continue on here\n"; <>; #wait for keypress to exit; # do your otherstuff here exit;
|
|---|