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
|
#!/perl/bin/perl
use Tk ;
@Etiquettes = (
'Identifiant : ' , 'Nom :' , 'Prénom :' , 'Ville : ' , 'Code postal :' ,
'Téléphone :' , 'Fax :' , 'e-mail :'
) ;
@Valeurs = ( ) ;
sub Valider
{
print "@Valeurs\n" ;
}
$fenetre = new MainWindow ( ) ;
$fenetre -> title ( 'Infos' ) ;
$c_infos = $fenetre -> Frame ( -relief => 'sunken' , -borderwidth => 2 ) ;
for ( $i = 0 ; $i <= $#Etiquettes ; $i++ )
{
$c_infos -> Label (
-text => $Etiquettes[$i] ,
-anchor => 'w'
) -> grid ( -row => $i , -column => 0 , -sticky => 'w' ) ;
$c_infos -> Entry (
-textvariable => \$Valeurs[$i]
) -> grid ( -row => $i , -column => 1 , -sticky => 'e' ) ;
}
$c_infos -> pack ( -side => 'top' , -pady => 2 , -ipadx => 2 , -ipady => 2 ) ;
$b_valider = $fenetre -> Button (
-text => 'Valider' ,
-command => \&Valider
) -> pack ( -side => 'left' , -padx => 20 ) ;
$b_quitter = $fenetre -> Button (
-text => 'Quitter' ,
-command => sub { exit ( 0 ) ; }
) -> pack ( -side => 'right' , -padx => 20 ) ;
MainLoop ( ) ; |
Partager