Perl Tk:Scheduler command called subroutine fails to talk to tk widgets
- From: "Andy" <anedza@xxxxxxxxxxxxxxxxxxxxxx>
- Date: 31 Jan 2007 11:05:18 -0800
I'm using the CPAN Tk::Scheduler module to time control the execution
of subroutines within my Perl script. I want to display the results
of a scheduled task in a tk text widget. But, when my subroutine gets
invoked by the scheduler via the -command switch, the called
subroutine itself seems to be unable to talk to any Perl::Tk widgets;
all such calls within the subroutine hang. Everything else seems to
work ok.
Does anyone know why? Do I have to call some sort of "refresh" tk
command or release tk resources?
use Tk;
use Tk::Schedule;
my $mw = MainWindow->new;
my $s = $mw->Schedule(
-interval => 60,
-repeat => "once",
-command => [\&run, "junk"],
-comment => "1-9999"
)->pack();
my $txtbox=$mw->Text(-width => 79,
-height => 8,
)->pack();
$txtbox->insert(end, "this works\n");
MainLoop;
sub run{
print "start run\n";
$txtbox->insert(end,"this just hangs\n");
print "exit run\n";
}
.
- Follow-Ups:
- Prev by Date: Re: ANNOUNCE: Xorg configuration model
- Next by Date: Re: HTML:Parser how to remove "//<![CDATA[ ... //]]>" ?
- Previous by thread: HTML:Parser how to remove "//<![CDATA[ ... //]]>" ?
- Next by thread: Re: Perl Tk:Scheduler command called subroutine fails to talk to tk widgets
- Index(es):
Relevant Pages
|
|