Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Drop-In Password Dialog?

by zentara (Archbishop)
on Nov 28, 2012 at 15:40 UTC ( #1006053=note: print w/replies, xml ) Need Help??

in reply to Drop-In Password Dialog?

Any time you call a Tk script for example, your original script will continue to run after the MainLoop is destroyed. So you can just make your own little password popup like this:
#!/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; # when the MainLoop is destroyed, the calling script can continue MainLoop; sub somesub { $password = $entry->get; print "password ->$password\n"; $mw->destroy; } print "you can continue on here\n"; <>; #wait for keypress to exit;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Drop-In Password Dialog?
by ColonelPanic (Friar) on Nov 29, 2012 at 06:32 UTC
    Thanks, this looks like it will be very helpful!

    When's the last time you used duct tape on a duct? --Larry Wall
Re^2: Drop-In Password Dialog?
by ColonelPanic (Friar) on Dec 03, 2012 at 15:07 UTC

    zentara, thanks again for this useful solution. I modified it slightly to also get a username, and it works great!

    When's the last time you used duct tape on a duct? --Larry Wall

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006053]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2016-10-24 13:00 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (305 votes). Check out past polls.