Hi everyone,
I'm dabbling for the first time with perltk. I've written a script
which does exactly what I want, except that it keeps on segfaulting
or producing bus errors after an indetermistic number of passes
through the main loop. Can anyone give me some hints on how to figure
out what the problem is? I've tried it on my Mac OS X 10.4 machine
and on this Linux server I have access to. perltk is the latest from
CPAN, and perl is 5.8.6 on my Mac and 5.8.3 on the Linux server. Here
is a trimmed down version of the script:
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
my @input =
("trial26","trial19","trial09","trial18","trial30","trial08","trial27","trial20","trial02","trial16","trial11","trial21","trial07","trial05","trial17","trial01","trial10","trial25","trial22","trial03","trial23","trial04","trial28","trial06","trial14","trial15","trial13","trial12","trial24","trial29",);
my %trials = (
"trial26" => "template21.bmp",
"trial19" => "template34.bmp",
"trial09" => "template24.bmp",
"trial18" => "template42.bmp",
"trial30" => "template23.bmp",
"trial08" => "template43.bmp",
"trial27" => "template32.bmp",
"trial20" => "template21.bmp",
"trial02" => "template14.bmp",
"trial16" => "template23.bmp",
"trial11" => "template23.bmp",
"trial21" => "template21.bmp",
"trial07" => "template23.bmp",
"trial05" => "template31.bmp",
"trial17" => "template21.bmp",
"trial01" => "template31.bmp",
"trial10" => "template21.bmp",
"trial25" => "template43.bmp",
"trial22" => "template24.bmp",
"trial03" => "template43.bmp",
"trial23" => "template24.bmp",
"trial04" => "template13.bmp",
"trial28" => "template31.bmp",
"trial06" => "template32.bmp",
"trial14" => "template31.bmp",
"trial15" => "template41.bmp",
"trial13" => "template21.bmp",
"trial12" => "template24.bmp",
"trial24" => "template43.bmp",
"trial29" => "template41.bmp",
);
# Main loop over trials
foreach my $trial (@input) {
my $template_file = $trials{$trial};
# Create the window
my $mw = MainWindow->new;
my $canvas = $mw->Canvas(-width => 102, -height => 77);
my $template = $mw->Photo(-file => $template_file);
$mw->{image_id} = $canvas->createImage(0, 0,
-anchor => 'nw',
-image => $template);
$canvas->pack;
# Snip...
# Typing 'return' ends the current trial
# (The next pass through the loop will show the next one)
$mw->bind('<Return>' =>
sub {
$mw -> destroy
});
MainLoop;
}
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/beginning_perl_tk/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/beginning_perl_tk/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:beginning_perl_tk-digest@xxxxxxxxxxxxxxx
mailto:beginning_perl_tk-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
beginning_perl_tk-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|