Well you sure are "beating your head against the wall" doing it that way. Just spend a few minutes and put the popup code into a module, that you can call from your scripts. That way you can return the user input into local variables. If you need help on how, show us the context you need to get user info, (a small example script), and we can show you a simple popup module.
For example:
Is there a way to catch that 'x' signal?#!/usr/bin/perl use Tk; my $MainWindow = MainWindow->new; $MainWindow->title("Data Entry Form"); $MainWindow -> Label(-justify => 'left', -text => "Name of person : ") ->pack(-side => 'left',-anchor => 'n'); my $entry = $MainWindow -> Entry(-selectborderwidth => 10) ->pack(-side => 'top',-anchor => 'n'); $entry->bind('<Return>',[\&somesub]); $entry->focus; $MainWindow -> Button(-text => "OK", -command => \&somesub) ->pack(-side => 'bottom',-anchor => 'center'); MainLoop; #your script can continue here after Tk is done while(1){print time; sleep 1;} sub somesub { $,="\n"; $NameOfPerson = $entry -> get; print "\nNameOfPerson ->$NameOfPerson\n"; $MainWindow -> destroy; }
Yes.
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; $mw->title("Close test"); $mw->geometry("400x250"); #prevents mw from closing $mw->protocol('WM_DELETE_WINDOW' => sub { print "do stuff here before the exit\n"; exit; }); MainLoop;
In reply to Re: Handling child process and close window exits in Perl/Tk
by zentara
in thread Handling child process and close window exits in Perl/Tk
by meliason
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |