The main problem here is that just because the command option can accept [$main => 'destroy'] as a configuration for an internal Callback does not mean that the same syntax can be used standalone outside of that context. What you're looking for is: $main->destroy like the following stripped down example.
use Tk; my $main = MainWindow->new; $main->Button( -text => 'Submit', -command => [\&Submit] )->pack; MainLoop; print "Script continues after mainloop terminated\n"; sub Submit { print "Submit called\n"; $main->destroy; }
Destroying the MainWindow allows the Event Loop created by MainLoop to terminate, allowing the lines following MainLoop to execute.
RobIn reply to Re: How do you exit PERL TK menu without exiting the script too ?
by rcseege
in thread How do you exit PERL TK menu without exiting the script too ?
by ljsmith91
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |