Bonjour,
J'ai ce petit programme :
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
 
def ouvrir():
    global dossier
 
    fichier = tkFileDialog.askopenfile()
    if fichier == None:
        return
 
    dossier = path.dirname(fichier.name)
    application.title("Dossier " + dossier)
    for nomfic in listdir(dossier):
        liste.insert(END, nomfic)
 
def choixDansListe(event):
    nomFichier = liste.get(int(liste.curselection()[0]))
    nomFichier = path.join(dossier, nomFichier)
 
    fichier = file(nomFichier, "r")
    contenu = fichier.read()
    texte.insert(CURRENT, contenu)
 
def creerInterface():
    global liste, texte, nomDossier
 
    barreDeMenus = Menu(application)
    application.config(menu = barreDeMenus)
 
    menuFichier = Menu(barreDeMenus)
    barreDeMenus.add_cascade(label="Fichiers", menu=menuFichier)
 
    menuFichier.add_command(label="Ouvrir...", command=ouvrir)
    menuFichier.add_separator()
 
 
    texte = Text(application, width=40, height=25, bg="#D0FFFF",
                 font=("Lucida Console", 9, "normal"))
    texte.pack(side=RIGHT, expand=True, fill=BOTH)
 
    panneau = Frame(application)
    panneau.pack(side=LEFT, fill=Y)
 
    liste = Listbox(panneau, width=25, height=20, bg="#FFD0FF")
    liste.bind('<Double-Button-1>', choixDansListe)
 
    scrollV = Scrollbar(panneau, command=liste.yview)
    liste.configure(yscrollcommand = scrollV.set)
 
    scrollH = Scrollbar(panneau, orient=HORIZONTAL, command=liste.xview)
    liste.configure(xscrollcommand = scrollH.set)
 
    scrollV.pack(side=RIGHT, expand=True, fill=Y)
    scrollH.pack(side=BOTTOM, expand=True, fill=X)
    liste.pack(side=TOP, expand=True, fill=Y)
 
 
application = Tk()
application.title("Visu")
 
creerInterface()
 
application.mainloop()
Je souhaiterai que le contenu du fichier choisi s'affiche directement, et non en le choisissant dans la liste, quelqu'un saurait comment je dois m'y prendre ?
Merci d'avance !