Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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

Comment on Re: Drop-In Password Dialog?
Download Code
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 drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2015-11-28 01:19 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (737 votes), past polls