IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Interfaces Graphiques Perl Discussion :

actualisation en fonction d'action


Sujet :

Interfaces Graphiques Perl

  1. #1
    Membre habitué Avatar de PadawanInPerl
    Profil pro
    Inscrit en
    Juillet 2009
    Messages
    462
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2009
    Messages : 462
    Points : 186
    Points
    186
    Par défaut actualisation en fonction d'action
    Bonjour,

    J'ai 2-3 souci...avec ce code...je tiens à préciser que ce sont des bouts de code que j'ai mis ensemble... :

    actuellement ce code me retourne bien le dossier actuel car rien est encore selectionné :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    if ($ent) {$rep = $ent;}
    else {$rep = '.';}
    opendir R_DIR,$rep or die "E/S : $!\n";
    Mais quand j'en sélectionne un rien ne se passe...ce qu'il y a en dessous ne se réinitialise pas...c'est surement normale mais je pas ou ça coince...

    voici le code entier :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    #! /usr/bin/perl
     
    # A FAIRE : lorsque l'on remonte l'arbre, le filtre .pl ne fonctionne pas.
     
    use warnings;
    use strict;
    use Tk;
     
    # CREATION DE LA FENETRE
    my $mw = MainWindow->new;
    $mw -> title("InterPerl");
    $mw-> geometry("800x600+60+30");
     
    # INITIALISATION DES VARIABLES
    my (@rep,@sous_rep,@fic,@total_fichier);
    my ($ent,$lst_f,$lst_r,$elem, $dossier,$nr,$resume,$retour,$rep);
     
    # INDICATION DU REPERTOIRE A TRAITER
    if ($ent) {$rep = $ent;}
    else {$rep = '.';}
    opendir R_DIR,$rep or die "E/S : $!\n";
     
    # CHOIX DU REPERTOIRE
    sub dirDialog {
        my $w = shift;
        my $ent = shift;
        my $dir;
        $dir = $w->chooseDirectory;
        if (defined $dir and $dir ne '') {
    	$ent->delete(0, 'end');
    	$ent->insert(0, $dir);
    	$ent->xview('end');
        }
    }
     
    # sub SELECTION DANS LA LISTE DE DROITE - SCRIPT
    sub list_select{
        $elem=$resume= '';
        my @select = $lst_f->curselection();
    	$elem = $lst_f->get($select[0]);
     
        open IN, "<$elem" or die "$!";
     
       while (my $line=<IN>){
         if ($line =~ /^##/) { $resume .= $line; }
         }
     
        if ($resume =~ /##/){
                $resume =~ s/## //g;
                $retour = $resume;
                }
        else {$retour = $elem;}
    }
     
    # sub LECTURE DU DOSSIER
    sub rep_list{
        my @select = $lst_r->curselection();
    	$dossier = $lst_r->get($select[0]);
     
        opendir R_LIRE, "$rep/$dossier" or die "E/S : $!\n";
     
        while (my $k = readdir(R_LIRE)){
    		next if $k =~ /^\./;
    		next if -d "$rep/$dossier/$k";
    		push @sous_rep,$k;
    	}
    	if ($dossier !~ /^\./){
    		$dossier = $rep . '/' . $dossier;
    	}
    	else { $dossier = $rep;}
    	$lst_f->delete(0,'end');
    	$lst_f->insert('end',sort tri @sous_rep);
    	$nr ="Il y a ${\ (@sous_rep + 0) } fichiers dans $dossier";
    	@sous_rep=();
    }
     
    # DEFINITION DES CADRE-BOX
    $ent = $mw->Entry(-width => 20);
    $ent->place(  -x => 0, -y => 25, -width => 200, -height => 20,);
     
    my $but = $mw->Button( -text => "Browse", -command => sub { dirDialog($mw, $ent)});
    $but->place(  -x => 205, -y => 25, -width => 95, -height => 20,);
     
    $lst_r = $mw->Scrolled(
    "Listbox",
    -scrollbars=>'e',
    -background => 'white',
    )->place(
            -x => 0, -y => 45, -width => 300, -height => 300,);
     
    $lst_f = $mw->Scrolled(
    "Listbox",
    -scrollbars=>'e',
    -background => 'white',
    )->place(
            -x => 350, -y => 30, -width => 400, -height => 300,);
     
    $lst_f->bind("<Button-1>",\&list_select);
    $lst_r->bind("<Button-1>",\&rep_list);
     
    # AFFICHE LE NOMBRE DE DOSSIER sub REP LIST
    $mw->Label(  -textvariable => \$dossier,
    	     -foreground => 'purple',)->place( -x => 350, -y => 0,);
     
    # AFFICHE LE NOM OU LE BUT DU SCRIPT sub LIST SELECT
    $mw->Label( -textvariable => \$retour,
                -justify => 'left',
                -foreground => '#CC0063')->place( -x => 280, -y => 370,);
     
    # TRAITEMENT REPERTOIRE ?
    while (my $fic = readdir(R_DIR)){
      next if $fic =~ /^\./;
    # saute les fichiers qui commencent avec .
    #  next if -d "$rep/$fic";# saute les répertoires
     
      if ( -d "$rep/$fic"){
        push @rep,$fic;
      }
      elsif ( -f "$rep/$fic" && $fic=~/\.pl/) {
        push @fic,$fic;
      }
    }
    unshift @rep,".";
     
    # TRI DU CADRE-BOX ?
    # trier sans tenir compte de la casse, un sort simple comme dans le 1er message
    # c'est un tri asciibetique (les chiffres,les majuscule ensuite les minuscules)
    # la fonction tri permet le tri alphabetique
     
    sub tri { lc($a) cmp lc($b) };
     
    $lst_f->insert('end',sort tri @fic);
    $lst_r->insert('end',sort tri @rep);
     
    $mw->Label(  -textvariable => \$nr,
    	     -foreground => 'brown',)->place( -x => 180 , -y => 350,);
    $mw->Label(  -text => "$rep contient ${\(@rep-1)} répertoires.",)->place( -x => 0, -y => 0,);
     
    $mw->Button( -text => 'Quitter',
    	     -command => sub {$mw->destroy()},)->place( -x => 650, -y => 370,);
    MainLoop;
    Windows 7, 64 bit
    Perl 5.12, ActivePerl
    Python 3.2, ActivePython ( NOVICE ! )

  2. #2
    Responsable Perl et Outils

    Avatar de djibril
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    19 820
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 19 820
    Points : 498 771
    Points
    498 771
    Par défaut
    Je n'ai rien compris à ton problème

  3. #3
    Membre habitué Avatar de PadawanInPerl
    Profil pro
    Inscrit en
    Juillet 2009
    Messages
    462
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2009
    Messages : 462
    Points : 186
    Points
    186
    Par défaut
    j'ai un champ qui me permet de choisir un répertoire, mais son contenu n'est pas affiché dans la partie du bas...
    Windows 7, 64 bit
    Perl 5.12, ActivePerl
    Python 3.2, ActivePython ( NOVICE ! )

  4. #4
    Membre habitué Avatar de PadawanInPerl
    Profil pro
    Inscrit en
    Juillet 2009
    Messages
    462
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2009
    Messages : 462
    Points : 186
    Points
    186
    Par défaut
    si tu lances le script, je pense que cela te sera évident...
    Windows 7, 64 bit
    Perl 5.12, ActivePerl
    Python 3.2, ActivePython ( NOVICE ! )

  5. #5
    Responsable Perl et Outils

    Avatar de djibril
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    19 820
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 19 820
    Points : 498 771
    Points
    498 771
    Par défaut
    non je ne comprends pas même en exécutant ton programme, je ne vois pas ce que tu cherches à faire .

    Et essaye d'indenter ton code, car sinon ce n'est pas assez lisible.

    Le voici indenté :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    #! /usr/bin/perl
     
    # A FAIRE : lorsque l'on remonte l'arbre, le filtre .pl ne fonctionne pas.
     
    use warnings;
    use strict;
    use Tk;
     
    # CREATION DE LA FENETRE
    my $mw = MainWindow->new;
    $mw->title("InterPerl");
    $mw->geometry("800x600+60+30");
     
    # INITIALISATION DES VARIABLES
    my ( @rep, @sous_rep, @fic, @total_fichier );
    my ( $ent, $lst_f, $lst_r, $elem, $dossier, $nr, $resume, $retour, $rep );
     
    # INDICATION DU REPERTOIRE A TRAITER
    if   ($ent) { $rep = $ent; }
    else        { $rep = '.'; }
    opendir R_DIR, $rep or die "E/S : $!\n";
     
    # CHOIX DU REPERTOIRE
    sub dirDialog {
      my $w   = shift;
      my $ent = shift;
      my $dir;
      $dir = $w->chooseDirectory;
      if ( defined $dir and $dir ne '' ) {
        $ent->delete( 0, 'end' );
        $ent->insert( 0, $dir );
        $ent->xview('end');
      }
    }
     
    # sub SELECTION DANS LA LISTE DE DROITE - SCRIPT
    sub list_select {
      $elem = $resume = '';
      my @select = $lst_f->curselection();
      $elem = $lst_f->get( $select[0] );
     
      open IN, "<$elem" or die "$!";
     
      while ( my $line = <IN> ) {
        if ( $line =~ /^##/ ) { $resume .= $line; }
      }
     
      if ( $resume =~ /##/ ) {
        $resume =~ s/## //g;
        $retour = $resume;
      }
      else { $retour = $elem; }
    }
     
    # sub LECTURE DU DOSSIER
    sub rep_list {
      my @select = $lst_r->curselection();
      $dossier = $lst_r->get( $select[0] );
     
      opendir R_LIRE, "$rep/$dossier" or die "E/S : $!\n";
     
      while ( my $k = readdir(R_LIRE) ) {
        next if $k =~ /^\./;
        next if -d "$rep/$dossier/$k";
        push @sous_rep, $k;
      }
      if ( $dossier !~ /^\./ ) {
        $dossier = $rep . '/' . $dossier;
      }
      else { $dossier = $rep; }
      $lst_f->delete( 0, 'end' );
      $lst_f->insert( 'end', sort tri @sous_rep );
      $nr       = "Il y a ${\ (@sous_rep + 0) } fichiers dans $dossier";
      @sous_rep = ();
    }
     
    # DEFINITION DES CADRE-BOX
    $ent = $mw->Entry( -width => 20 );
    $ent->place( -x => 0, -y => 25, -width => 200, -height => 20, );
     
    my $but = $mw->Button( -text => "Browse", -command => sub { dirDialog( $mw, $ent ) } );
    $but->place( -x => 205, -y => 25, -width => 95, -height => 20, );
     
    $lst_r = $mw->Scrolled(
      "Listbox",
      -scrollbars => 'e',
      -background => 'white',
    )->place( -x => 0, -y => 45, -width => 300, -height => 300, );
     
    $lst_f = $mw->Scrolled(
      "Listbox",
      -scrollbars => 'e',
      -background => 'white',
    )->place( -x => 350, -y => 30, -width => 400, -height => 300, );
     
    $lst_f->bind( "<Button-1>", \&list_select );
    $lst_r->bind( "<Button-1>", \&rep_list );
     
    # AFFICHE LE NOMBRE DE DOSSIER sub REP LIST
    $mw->Label(
      -textvariable => \$dossier,
      -foreground   => 'purple',
    )->place( -x => 350, -y => 0, );
     
    # AFFICHE LE NOM OU LE BUT DU SCRIPT sub LIST SELECT
    $mw->Label(
      -textvariable => \$retour,
      -justify      => 'left',
      -foreground   => '#CC0063'
    )->place( -x => 280, -y => 370, );
     
    # TRAITEMENT REPERTOIRE ?
    while ( my $fic = readdir(R_DIR) ) {
      next if $fic =~ /^\./;
     
      # saute les fichiers qui commencent avec .
      #  next if -d "$rep/$fic";# saute les répertoires
     
      if ( -d "$rep/$fic" ) {
        push @rep, $fic;
      }
      elsif ( -f "$rep/$fic" && $fic =~ /\.pl/ ) {
        push @fic, $fic;
      }
    }
    unshift @rep, ".";
     
    # TRI DU CADRE-BOX ?
    # trier sans tenir compte de la casse, un sort simple comme dans le 1er message
    # c'est un tri asciibetique (les chiffres,les majuscule ensuite les minuscules)
    # la fonction tri permet le tri alphabetique
     
    sub tri { lc($a) cmp lc($b) }
     
    $lst_f->insert( 'end', sort tri @fic );
    $lst_r->insert( 'end', sort tri @rep );
     
    $mw->Label(
      -textvariable => \$nr,
      -foreground   => 'brown',
    )->place( -x => 180, -y => 350, );
    $mw->Label( -text => "$rep contient ${\(@rep-1)} répertoires.", )->place( -x => 0, -y => 0, );
     
    $mw->Button(
      -text    => 'Quitter',
      -command => sub { $mw->destroy() },
    )->place( -x => 650, -y => 370, );
    MainLoop;

  6. #6
    Membre habitué Avatar de PadawanInPerl
    Profil pro
    Inscrit en
    Juillet 2009
    Messages
    462
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2009
    Messages : 462
    Points : 186
    Points
    186
    Par défaut
    ok je ré-essaye...

    4 zones :
    1) en haut à gauche qui me permet de selectionner un dossier
    2) en dessous du précédent...j'espérais faire afficher les dossiers contenu
    dans le dossier du 1)
    or pour le moment il m'affiche par défaut '.'
    3) à droite la liste des fichiers contenu dans mes dossier du 2)
    4) tout en bas : affichage du titre ou du contenu d'un des fichiers du 3)

    Le problème avec ce script est que c'est un embriquement de script pris ici et là... je pense qu'il manque certaine liaisons...en fait j'en suis sûr

    Maintenant, si je veux changer de dossier en 1), rien ne se passe, je reste toujours dans mon '.'

    alors ? c'est clair ou au moins un peu plus. ?
    Windows 7, 64 bit
    Perl 5.12, ActivePerl
    Python 3.2, ActivePython ( NOVICE ! )

  7. #7
    Responsable Perl et Outils

    Avatar de djibril
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    19 820
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 19 820
    Points : 498 771
    Points
    498 771
    Par défaut
    Essaye de respecter les consignes que je t'avais filé dans un autre thread.
    - indentation
    - procédure après la mainloop

    bon je regarde ton code

    Ton souci est ici

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    sub dirDialog {
      my $w   = shift;
      my $ent = shift;
      my $dir;
      $dir = $w->chooseDirectory;
      if ( defined $dir and $dir ne '' ) {
        $ent->delete( 0, 'end' );
        $ent->insert( 0, $dir );
        $ent->xview('end');
      }
    }
    Là c'est ok, mais pas terminer. Si l'on sélectionne un fichier, le champ de saisie est mis à jour, mais pour ton souci, bah faut dire à Tk de faire quelque chose.

  8. #8
    Membre habitué Avatar de PadawanInPerl
    Profil pro
    Inscrit en
    Juillet 2009
    Messages
    462
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2009
    Messages : 462
    Points : 186
    Points
    186
    Par défaut
    J'ai un RDV,

    A demain.
    Windows 7, 64 bit
    Perl 5.12, ActivePerl
    Python 3.2, ActivePython ( NOVICE ! )

  9. #9
    Responsable Perl et Outils

    Avatar de djibril
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    19 820
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 19 820
    Points : 498 771
    Points
    498 771
    Par défaut
    Petit exemple :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    sub dirDialog {
      my $w   = shift;
      my $ent = shift;
      my $lst_r = shift;
      my $dir;
      $dir = $w->chooseDirectory;
      if ( defined $dir and $dir ne '' ) {
        $ent->delete( 0, 'end' );
        $ent->insert( 0, $dir );
        $ent->xview('end');
     
        # On lui dit de faire quelque chose en plus
        $lst_r->delete( 0, 'end' );
        $lst_r->insert('end', 'PadawanInPerl' );
      }
    }

  10. #10
    Membre habitué Avatar de PadawanInPerl
    Profil pro
    Inscrit en
    Juillet 2009
    Messages
    462
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2009
    Messages : 462
    Points : 186
    Points
    186
    Par défaut
    Tk::Error: Can't call method "delete" on an undefined value at C:\DOCUME~1\xxx
    \Bureau\SCRIPT~1\INTERP~1\17test1.pl line 35. ($lst_r->delete( 0, 'end' )
    main::dirDialog at C:\DOCUME~1\xxx\Bureau\SCRIPT~1\INTERP~1\17test1.pl line 3
    5
    main::__ANON__ at C:\DOCUME~1\xxx\Bureau\SCRIPT~1\INTERP~1\17test1.pl line 85 (my $but = $mw->Button( -text => "Browse", -command => sub { dirDialog( $mw, $ent ) } )

    Tk callback for .button
    Tk::__ANON__ at C:/Perl/site/lib/Tk.pm line 250
    Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 175
    <ButtonRelease-1>
    (command bound to event)
    Windows 7, 64 bit
    Perl 5.12, ActivePerl
    Python 3.2, ActivePython ( NOVICE ! )

  11. #11
    Membre habitué Avatar de PadawanInPerl
    Profil pro
    Inscrit en
    Juillet 2009
    Messages
    462
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2009
    Messages : 462
    Points : 186
    Points
    186
    Par défaut
    ok oublie, je viens de palier au message précédent...là je m'attaque à d'autre problème...

    Je te remerci Djibril, je ne close pas la discussion...car je vais revenir...
    Windows 7, 64 bit
    Perl 5.12, ActivePerl
    Python 3.2, ActivePython ( NOVICE ! )

  12. #12
    Membre habitué Avatar de PadawanInPerl
    Profil pro
    Inscrit en
    Juillet 2009
    Messages
    462
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2009
    Messages : 462
    Points : 186
    Points
    186
    Par défaut
    J'ai procédé d'une autre manière...qui est différente de ce que je faire.

    Mais qui me suffit pour le moment.

    Merci Djibril

    Je met ci-dessous mon code au cas ou cela intéresserait quelqu'un.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    #!/usr/local/bin/perl
     
    use strict;
    use Tk;
    use Tk::DirTree;
    use TK::Photo;
     
     
    my $mw = MainWindow->new(-title=>'InterPerl');
    $mw->geometry("800x600+60+30");
     
    # ===== CHANGEMENT D'ICONE DE FENETRE =====
     
    my $MaNouvelleIcone = $mw->Photo( -file => "perle.gif" );
    $mw->iconimage($MaNouvelleIcone);
     
    # INITIALISATION DES VARIABLES
    my ($lst_f, $lst_r, $elem, $resume, $retour,$repertoire);
    my(@files);
     
    # DEFINITION DES CADRE-BOX
    $lst_f = $mw->Scrolled(
      "Listbox",
      -scrollbars => 'e',
      -background => 'white',
      -foreground =>"black",
    )->place( -x => 350, -y => 30, -width => 400, -height => 300, );
     
    $lst_f->bind( "<Button-1>", \&list_select );
     
    $lst_r  = $mw->Scrolled('DirTree',-scrollbars =>'e',-directory=>"C:/",
        -command=>\&repertoire)->place( -x => 0, -y => 30, -width => 300, -height => 300, );
    $lst_r->configure(-background =>"lightblue", -foreground =>"#CC0063", -showhidden=>1) ;
    $lst_r->Subwidget("yscrollbar")->configure(-background => "lightgreen",-troughcolor => "blue") ;
     
    # AFFICHE LE NOM OU LE BUT DU SCRIPT sub LIST SELECT
    $mw->Label(
      -textvariable => \$retour,
      -justify      => 'left',
      -foreground   => '#CC0063'
    )->place( -x => 280, -y => 370, );
     
     
    sub list_select {
      $elem = $resume = '';
      my @select = $lst_f->curselection();
      $elem = $lst_f->get( $select[0] );
     
      open IN, "<$elem" or die "$!";
     
      while ( my $line = <IN> ) {
        if ( $line =~ /^##/ ) { $resume .= $line; }
      }
     
      if ( $resume =~ /##/ ) {
        $resume =~ s/## //g;
        $retour = $resume;
      }
      else { $retour = $elem; }
    }
     
     
    sub repertoire
    {
      my $nd=shift;
      chdir $nd;
      $repertoire=$nd;
      @files=() ;
      $lst_f->delete(0,'end') ;
      my @allfiles=() ;
      opendir DH,$nd ;
      @allfiles=readdir DH ;
      closedir DH ;
      foreach (@allfiles)
      {
        if(-f $_ && $_ =~ /\.pl/)
        {
          push(@files,$_) ;
          $lst_f->insert('end',$_) ;
        }
      }
    }
     
     
    $mw->Button(
      -text    => 'Quitter',
      -command => sub { $mw->destroy() },
    )->place( -x => 650, -y => 370, );
     
     
    MainLoop;
    Windows 7, 64 bit
    Perl 5.12, ActivePerl
    Python 3.2, ActivePython ( NOVICE ! )

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Actualiser liste déroulante après action
    Par rgdu86 dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 02/06/2008, 14h08
  2. donner le focus en fonction des actions
    Par mali_67 dans le forum Général JavaScript
    Réponses: 19
    Dernier message: 17/03/2008, 14h28
  3. redirection dynamique vers une ancre qui est fonction d'actions antérieues
    Par j.p.mignot dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 16/01/2008, 16h33
  4. Réponses: 1
    Dernier message: 07/11/2007, 10h06
  5. Appeler une fonction avec "action" ds un
    Par drinkmilk dans le forum ASP
    Réponses: 4
    Dernier message: 20/04/2004, 14h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo