1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| #!/usr/bin/perl
use Tk;
use warnings;
use strict;
use Tk::Pane;
# Programme principal
# Création de la fenêtre
my $fenetre = new MainWindow(
-title => "Fenetre grid",
-background => "white",
);
my $BarreHor = $fenetre->Scrollbar( -orient => 'horizontal');
my $BarreVer = $fenetre->Scrollbar( -width => 50 );
my $FramePane = $fenetre->Pane(
-height => 500,
-width => 500,
-yscrollcommand => ['set',$BarreVer],
-xscrollcommand => ['set',$BarreHor],
);
$BarreHor->configure( -command => ['xview', $FramePane], );
$BarreVer->configure( -command => ['yview', $FramePane], );
$BarreVer->pack( qw/-side right -fill y/ );
$BarreHor->pack( qw/-side bottom -fill x/ );
$FramePane->pack( qw/ -fill both -expand 1/ );
# 6 boutons
my $Bouton1 = $FramePane->Button( -text => "Num1", -height => 50, -width => 50,);
my $Bouton2 = $FramePane->Button( -text => "Num2", -height => 50, -width => 50, );
my $Bouton3 = $FramePane->Button( -text => "Num3", -height => 50, -width => 50, );
my $Bouton4 = $FramePane->Button( -text => "Num4", -height => 50, -width => 50, );
my $Bouton5 = $FramePane->Button( -text => "Num5", -height => 50, -width => 50, );
my $Bouton6 = $FramePane->Button( -text => "Num6", -height => 50, -width => 50, );
$Bouton1->grid($Bouton2, $Bouton3);
$Bouton4->grid($Bouton5,$Bouton6);
MainLoop(); |
Partager