1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| use Tk ;
$x1 = 0;
$y1 = 0;
$x2 = 100;
$y2 = 100;
sub Bas {
$y1 += 1 if $y1 < 400 && $y2 < 400;
$y2 += 1 if $y2 < 400 && $y1 < 400;
print "$y1, $y2\n";
$rec = $caneva -> create ( 'rectangle', "$x1","$y1","$x2","$y2", -fill => 'blue' );
}
$fenetre = MainWindow -> new ;
$caneva = $fenetre -> Canvas ( -width => 400 , -height => 400 ,-background => 'white') ;
$rec = $caneva -> create ( 'rectangle', "$x1","$y1","$x2","$y2", -fill => 'blue' );
$caneva -> pack ( ) ;
$fenetre -> bind ('<Key>', \&Bas);
MainLoop ; |
Partager