Bonjour,
j'ai fait une interface graphique de test pour afficher des matrices
les matrcices sont stocker dans un tableau
je veux afficher toutes les matrices une par une
j'ai réalisé l'affichage de la premiere mais pas toutes
le probleme que lorseque j'appuis sur le bouton $i ne sincremente pas
je veux qu'il m'affiche les 40 elements du tableaux qui suit
my $button3 = create_arrow_button( 'left' , 'in' );
my $button4 = create_arrow_button( 'right' , 'out' );
# Cr ́ation de la table
my $table = Gtk2::Table->new(7 ,8 ,TRUE) ;
$window->add( $table ) ;
my @Tfin =(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,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80);
#création les labels contenant les numero de sequences statiquement
my $label1 = Gtk2::Label->new( "$Tfin[$i]" );
my $label2 = Gtk2::Label->new( "$Tfin[$i+1]" );
my $label3 = Gtk2::Label->new( "$Tfin[$i+2]" );
my $label4 = Gtk2::Label->new( "$Tfin[$i+3]" );
my $label5 = Gtk2::Label->new( "$Tfin[$i+4]" );
my $label6 = Gtk2::Label->new( "$Tfin[$i+5]" );
my $label7 = Gtk2::Label->new( "$Tfin[$i+6]" );
my $label8 = Gtk2::Label->new( "$Tfin[$i+7]" );
my $label9 = Gtk2::Label->new( "$Tfin[$i+8]" );
my $label10 = Gtk2::Label->new("$Tfin[$i+9]" );
my $label11 = Gtk2::Label->new( "$Tfin[$i+10]" );
my $label12 = Gtk2::Label->new( "$Tfin[$i+11]" );
my $label13 = Gtk2::Label->new( "$Tfin[$i+12]" );
my $label14 = Gtk2::Label->new( "$Tfin[$i+13]" );
my $label15 = Gtk2::Label->new( "$Tfin[$i+14]" );
my $label16 = Gtk2::Label->new( "$Tfin[$i+15]" );
my $label17 = Gtk2::Label->new( "$Tfin[$i+16]" );
my $label18 = Gtk2::Label->new( "$Tfin[$i+17]" );
my $label19 = Gtk2::Label->new( "$Tfin[$i+18]" );
my $label20 = Gtk2::Label->new( "$Tfin[$i+19]" );
my $label21 = Gtk2::Label->new( "$Tfin[$i+20]" );
my $label22 = Gtk2::Label->new( "$Tfin[$i+21]" );
my $label23 = Gtk2::Label->new( "$Tfin[$i+22]" );
my $label24 = Gtk2::Label->new( "$Tfin[$i+23]" );
my $label25 = Gtk2::Label->new( "$Tfin[$i+24]" );
my $label26 = Gtk2::Label->new( "$Tfin[$i+25]" );
my $label27 = Gtk2::Label->new( "$Tfin[$i+26]" );
my $label28 = Gtk2::Label->new( "$Tfin[$i+27]" );
my $label29 = Gtk2::Label->new( "$Tfin[$i+28]" );
my $label30 = Gtk2::Label->new( "$Tfin[$i+29]" );
my $label31 = Gtk2::Label->new( "$Tfin[$i+30]" );
my $label32 = Gtk2::Label->new( "$Tfin[$i+31]" );
my $label33 = Gtk2::Label->new( "$Tfin[$i+32]" );
my $label34 = Gtk2::Label->new( "$Tfin[$i+33]" );
my $label35 = Gtk2::Label->new( "$Tfin[$i+34]" );
my $label36 = Gtk2::Label->new( "$Tfin[$i+35]" );
my $label37 = Gtk2::Label->new( "$Tfin[$i+36]" );
my $label38 = Gtk2::Label->new( "$Tfin[$i+37]" );
my $label39 = Gtk2::Label->new( "$Tfin[$i+38]" );
my $label40 = Gtk2::Label->new( "$Tfin[$i+39]" );
# insertion des labels construits statiquement
$table->attach_defaults( $label1, 0, 1 , 0 , 1 ) ;
$table->attach_defaults( $label2, 1, 2 , 0 , 1 ) ;
$table->attach_defaults( $label3, 2, 3 , 0 , 1 ) ;
$table->attach_defaults( $label4, 3, 4 , 0 , 1 ) ;
$table->attach_defaults( $label5, 4, 5 , 0 , 1 ) ;
$table->attach_defaults( $label6, 5, 6 , 0 , 1 ) ;
$table->attach_defaults( $label7, 6, 7 , 0 , 1 ) ;
$table->attach_defaults( $label8, 7, 8 , 0 , 1 ) ;
$table->attach_defaults( $label9, 0, 1 , 1 , 2 ) ;
$table->attach_defaults( $label10, 1, 2 , 1 , 2 ) ;
$table->attach_defaults( $label11, 2, 3 , 1 , 2 ) ;
$table->attach_defaults( $label12, 3, 4 , 1 , 2 ) ;
$table->attach_defaults( $label13, 4, 5 , 1 , 2 ) ;
$table->attach_defaults( $label14, 5, 6 , 1 , 2 ) ;
$table->attach_defaults( $label15, 6, 7 , 1 , 2 ) ;
$table->attach_defaults( $label16, 7, 8 , 1 , 2 ) ;
$table->attach_defaults( $label17, 0, 1 , 2 , 3 ) ;
$table->attach_defaults( $label18, 1, 2 , 2 , 3 ) ;
$table->attach_defaults( $label19, 2, 3 , 2 , 3 ) ;
$table->attach_defaults( $label20, 3, 4 , 2 , 3 ) ;
$table->attach_defaults( $label21, 4, 5 , 2 , 3 ) ;
$table->attach_defaults( $label22, 5, 6 , 2 , 3 ) ;
$table->attach_defaults( $label23, 6, 7 , 2 , 3 ) ;
$table->attach_defaults( $label24, 7, 8 , 2 , 3 ) ;
$table->attach_defaults( $label25, 0, 1 , 3 , 4 ) ;
$table->attach_defaults( $label26, 1, 2 , 3 , 4 ) ;
$table->attach_defaults( $label27, 2, 3 , 3 , 4 ) ;
$table->attach_defaults( $label28, 3, 4 , 3 , 4 ) ;
$table->attach_defaults( $label29, 4, 5 , 3 , 4 ) ;
$table->attach_defaults( $label30, 5, 6 , 3 , 4 ) ;
$table->attach_defaults( $label31, 6, 7 , 3 , 4 ) ;
$table->attach_defaults( $label32, 7, 8 , 3 , 4 ) ;
$table->attach_defaults( $label33, 0, 1 , 4 , 5 ) ;
$table->attach_defaults( $label34, 1, 2 , 4 , 5 ) ;
$table->attach_defaults( $label35, 2, 3 , 4 , 5 ) ;
$table->attach_defaults( $label36, 3, 4 , 4 , 5 ) ;
$table->attach_defaults( $label37, 4, 5 , 4 , 5 ) ;
$table->attach_defaults( $label38, 5, 6 , 4 , 5 ) ;
$table->attach_defaults( $label39, 6, 7 , 4 , 5 ) ;
$table->attach_defaults( $label40, 7, 8 , 4 , 5 ) ;
$table->attach_defaults( $button3, 1, 3 , 7 , 8 ) ;
$table->attach_defaults( $button4, 5, 7 , 7 , 8 ) ;
$table->show() ; # fonction permet l'affichage de la table de widget
$window->show() ; # fonction permet l'affichage de la fenetre
$window->show_all() ; # fonction permet l'affichage de touts les composants de la fenetre
# On lance la boucle principale
Gtk2->main ;
### fonction de rappel
sub create_arrow_button {
my ( $arrow_type, $shadow_type ) = @_ ;
my $button = Gtk2::Button->new() ;
my $arrow = Gtk2::Arrow->new( $arrow_type, $shadow_type ) ;
$button->add( $arrow ) ;
$button->show() ;
$arrow->show() ;
return ( $button ) ;
}
sub inc {
$i=$i+1;
}
merci de me repondre c'est tres urgent mes Mr et Mme
Afficher la suite