Salut à tous.
Je fais un programme en perl Tk et j'ai un petit probleme au niveau de l'interface graphique.
En effet je desire afficher 2 fenetre. Jusque la pas de soucis.
Mon probleme est que si je ferme ces deux fenetre et que je veut les réouvrir sa plante quand je veut les refermer.
voici ma fonction:
sub affrapp2
{
$nom_du_rapport=$_[0]; #récupération du nom du rapport à afficher
if(!Exists($w_aff))
{
$w_aff = $mw->Toplevel();
$w_aff->title("$nom_du_rapport" );
$w_aff->Button(-text =>"fermer",-command=>sub{$w_aff->withdraw})->pack(-side => 'bottom',-fill => 'x');
$texte_aff=$w_aff->Scrolled("Text" )->pack(-side => 'top',-expand => 1,-fill => 'both');
open (RAPPORT,$chemin_rapport_lecture."$nom_du_rapport" ) || die "Impossible d'ouvrir $nom_du_rapport\n";
while(<RAPPORT> )
{
$texte_aff->insert('end',$_);
}
close(RAPPORT);
}
else
{
$w_aff2 = $mw->Toplevel();
$w_aff2->title("$nom_du_rapport" );
$w_aff2->Button(-text =>"fermer",-command=>sub{$w_aff2->withdraw})->pack(-side => 'bottom',-fill => 'x');
$texte_aff2=$w_aff2->Scrolled("Text" )->pack(-side => 'top',-expand => 1,-fill => 'both');
$texte_aff2->insert('end',"w_aff2\n" );
open (RAPPORT,$chemin_rapport_lecture."$nom_du_rapport" ) || die "Impossible d'ouvrir $nom_du_rapport\n";
while(<RAPPORT> )
{
$texte_aff2->insert('end',$_);
}
close(RAPPORT);
}
}
quelqu'un a une idée?