IB2017 has asked for the wisdom of the Perl Monks concerning the following question:
This is surely something stupid... but I have no good ideas tonight. I want to a) create a Tk (main) window, b) after the window has been displayed, call a subroutine, c) when the subroutine has been performed, destroy the window. In my script, Tk is correctly expecting an event to call the subrutine. Which is the best method to automate this?
use strict; use warnings; use Tk; my $mw = MainWindow->new(); $mw->Label( -text => "Wait", -font => [-family => 'times', -size => 20], )->pack(-expand => '1', -fill => 'both'); $mw->MainLoop; doSomething($mw);#this is doing nothing here, it should be automatical +ly called after creation and display of mainwindow sub doSomething{ my $mw = shift; print "Hello!\n"; $mw->destroy; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Calling subrutine after creating Tk mainwindow
by choroba (Cardinal) on Jan 26, 2018 at 16:48 UTC | |
|
Re: Calling subrutine after creating Tk mainwindow
by tybalt89 (Monsignor) on Jan 26, 2018 at 16:45 UTC | |
by IB2017 (Pilgrim) on Jan 26, 2018 at 16:55 UTC | |
|
Re: Calling subrutine after creating Tk mainwindow
by kcott (Archbishop) on Jan 27, 2018 at 19:44 UTC |