J'ai une erreur en essayant de lancer mon interface graphique avec la commande, python3 projGUI.py, je vous joins mon code :

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
 
#!/usr/bin/python
# -*- coding: utf-8 -*-
 
from tkinter import *
import os
 
def afficherFichiers(dossier) :
    for s in os.listdir():
        if ".vcf" in s or ".ics" in s:
            display.insert('end', s + '\n')
 
def afficherDossier():
 
    for s in os.listdir():
        if os.path.isdir(s):
            display2.insert('end', s + '\n')
 
 
if __name__ == '__main__':
 
    #creer la fenetre
    GUI = tk.Tk()
 
    #personnaliser la fenetre
    GUI.title("GUI principal")
    GUI.maxsize(1280, 600)
    GUI.minsize(640, 400)
    GUI.iconbitmap("logo/logo.ico")
    GUI.config(background='lightblue')
 
 
    labelINFO = Label(GUI, text="test", font=("Arial", 12), bg='lightblue')
    labelINFO.pack()
 
    frameGauche = Frame(GUI, bg='lightblue', bd=1, relief=SUNKEN, )
 
    btn = Button(frameGauche, text='test', command=afficherFichiers)
    btn.pack()
 
    display = Listbox(frameGauche)
    display.pack()
 
 
    frameGauche.pack(side=LEFT)
 
    frameDroite = Frame(GUI, bg='lightblue', bd=1, relief=SUNKEN)
 
    display2 = Listbox(frameDroite)
    display2.pack()
 
    btn2 = Button(frameDroite, text='afficher', command=afficherDossier)
    btn2.pack()
 
 
    frameDroite.pack(side=RIGHT)
 
    frameCentral = Frame(GUI, bg='lightblue', bd=1, relief=SUNKEN)
 
    labeltest = Label(frameCentral, text="test", font=("Arial", 12), bg='lightblue')
    labeltest.pack()
 
    frameCentral.pack()
 
    GUI.mainloop()