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 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#!/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",
);
$fenetre->geometry("1023x710+0+0");
my $uneFrame = $fenetre->Frame();
my $BarreHor = $uneFrame->Scrollbar( -orient => 'horizontal');
my $BarreVer = $uneFrame->Scrollbar( -width => 50 );
my $FramePane = $uneFrame->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);
$uneFrame->pack(
-pady => 50,
-padx => 50,
-ipadx => 50,
-ipady => 50,
);
$uneFrame->update; #j'ai teste ca mais ca ne fonctionne pas ...
$fenetre->update;
$fenetre->geometry( $fenetre->width+1 . "x" . $fenetre->height . "+0+0" );
MainLoop(); |
Partager