in reply to Code after MainLoop; Tk

G'day PerlCowboy,

Welcome to the Monastery.

I've assumed you wrote "Reaped: Executing code after MainLoop; using Tk" before logging in. It's virtually identical to this post: both have the same problem and the same solution (already supplied by AnonymousMonk in "Re: Code after MainLoop; Tk"). I've requested that it be removed (which, on previewing, I see it has): you don't have to do anything else about this.

To expand upon AnonymousMonk's reply, you can find documentation

Here's your problem and solution in a nutshell:

#!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = MainWindow->new; $mw->Button(-text => 'Problem: exit', -command => sub { exit } )->pack; $mw->Button(-text => 'Solution: destroy', -command => sub { $mw->destroy } )->pack; MainLoop; print "After MainLoop\n";

Test runs:

$ pm_1165366_tk_post_loop.pl # Test Problem $ pm_1165366_tk_post_loop.pl # Test Solution After MainLoop $

See also: Tk::callbacks.

— Ken