Hallo!
Ich gebe eine Grafik in einer Canvas aus.
Nach 2 Sekunden soll dann die nächste Grafik erscheinen deren Dateiname sich in einem Array namens @fotos befindet.
Hier ist mein Code:
# use strict und alles weiter ist anuse Tk;
use Tk::JPEG;
use Tk::PNG;
my $gdir = 'c:/apache/htdocs/grafiken/';
my @fotos = qw(visitenKarte.png cms/cms_logo2.gif igs/logo5_o.jpg);
my $mw = MainWindow->new(-width=>800, -height=>640,);
my $c = $mw->Canvas(
-width => 1,
-height => 1,
-background => 'dark slate gray',
)->pack;
my $id = undef;
my $cnt = 0;
$id = $mw->repeat(2000, sub{ main::count($mw) });
sub count {
if( $cnt < scalar(@fotos) ){
my $cnt ++
}else{
$cnt = 0;
}
my $foto = $c->Photo(-file => $gdir.$fotos[$cnt]);
$c->createImage(0, 0,
-image => $foto,
-tag => $fotos[$cnt],
-anchor => 'nw',
);
$c->configure(-width => $foto->width(), -height => $foto->height());
$c->update();
}
MainLoop;
Muss man das alte Bild erst irgendwie entfernen?
mfg pktm
Datum: 15.11.2004-19:22
