herby1620 has asked for the wisdom of the Perl Monks concerning the following question:
And this is fine. The problem is that I seek not to exit the program (the command says 'exit'), but rather to return from 'MainLoop' so I can do something else. It is possible that I could have several instances of code like this, and I'd rather not keep going thru memory with wierd returns from code (shades of 'goto'). If I make the command executed by the button just 'return', I'll just return and await the next event (another button press!). Does Perl/Tk have something that will cause 'MainLoop' to return to its caller. The documentation is a bit vague on this point! Thanks.#!/usr/bin/perl -w use Tk; my $mw = MainWindow->new; $mw->Button (-text => "Hello World!", -command => sub {exit})->pack; MainLoop;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl Tk-How to return from 'MainLoop'
by GrandFather (Saint) on May 04, 2006 at 02:00 UTC | |
Re: Perl Tk-How to return from 'MainLoop'
by jdtoronto (Prior) on May 04, 2006 at 02:58 UTC | |
Re: Perl Tk-How to return from 'MainLoop'
by strat (Canon) on May 04, 2006 at 07:39 UTC |