Bonjours j'ai un dossier qui contient les fichiers nécessaire pour pour le programme principale (image, arrière plan etc ...) lorsque je met la ligne de code import info.py cela importe le programme info mais pas les image et j'ai l'erreur suivante :

TclError : Image "pyimage5" doesn't exist


Voicfi le code source du programme principal :

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
149
150
151
152
153
154
155
156
157
158
159
160
 
 
# -*- coding: Latin-1 -*-
 
 
# **** DEVELOPED BY  (STUFFY-92)  [  FRENCH ]  **** #
 
 
# =================================================== #
#                                               #
#     Version : Betâ 1.0                                                                  #
#     Auteur : Stuffy                                                                     #
#     Année : 2008                            #
#     Localisation : France ,  92100                    #
#     Licence : GPL                                                                        #
#                                               #
# =================================================== #
 
 
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
 
 
# IMPORTATION DES BIBLIOTEQUES #
 
from Tkinter import*
import tkMessageBox
import tkFont
 
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
 
 
#  ===== SCRIPT SYSTEME =====  #
 
 
 
 
URL = "  www.clg-bartholdi-boulogne.ac-versailles.fr"
HOST_URL = "127.0.0.1  www.clg-bartholdi-boulogne.ac-versailles.fr"
mod_cur = 0
 
def cursor_restaure ():
 
    bouton3.configure(cursor='@cursor_stop.cur')
    bouton2.configure(cursor='@cursor_add.cur')
 
def cursor_desactive ():    
 
    bouton3.configure(cursor='@cursor_add.cur')
    bouton2.configure(cursor='@cursor_stop.cur')
 
def desactivation ():
 
    cursor_restaure()
 
    if HOST_URL in file("C:\WINDOWS\system32\drivers\etc\hosts"):
 
        tkMessageBox.showinfo("Info", "Vous avez déjà désactivé le site.")
 
 
    else:
 
        hosts_copy = open('C:\WINDOWS\system32\drivers\etc\hosts','r')
        hosts_save = open('hosts_save','w')
 
        while 1:
 
            chaine_copy = hosts_copy.readline(50)
 
            if (chaine_copy == ""):
 
                break
 
            chaine_save = hosts_save.write(chaine_copy)
 
        hosts_save.close()
        hosts_copy.close()
 
 
        write_hosts = open('C:\WINDOWS\system32\drivers\etc\hosts','a')
        host = write_hosts.write("\n127.0.0.1")
        host = write_hosts.write(URL)
        write_hosts.close()
 
 
 
def restauration ():
 
    cursor_desactive()
 
    if HOST_URL in file("C:\WINDOWS\system32\drivers\etc\hosts"):
 
        read_hosts = open("hosts_save", "r")
        restore_hosts = open('C:\WINDOWS\system32\drivers\etc\hosts','w')
 
        while 1:
 
            read_chaine = read_hosts.readline(50)
 
            if (read_chaine == ""):
 
                break
 
            restore_chaine = restore_hosts.write(read_chaine)
 
        read_hosts.close()
        restore_hosts.close()
 
    else:
        tkMessageBox.showinfo("info", "Le site est déjà débloqué.")
 
def about (): 
 
    import Info.py
 
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
 
 
#  ===== SCRIPT VISUEL =====  #
 
fenetre=Tk()
fenetre.title('Block-Mark')
fenetre.iconbitmap("Ressources\Images\Icon.ico")
fenetre.geometry("280x100")
fenetre.resizable(width=False, height=False)
fenetre.configure(cursor='@cursor_normal.cur')
 
img1 = PhotoImage(file = "Ressources\Images\Désactiver.gif")
img2 = PhotoImage(file = "Ressources\Images\Restaurer.gif")
img3 = PhotoImage(file = "Ressources\Images\About.gif")
img4 = PhotoImage(file = "Ressources\Images\Background.gif")
 
fond = Label(fenetre)
fond.configure( image = img4 )
fond.pack()
 
bouton1=Button(fenetre)
bouton1.configure(command = about, image = img3, relief = FLAT, bd = 0, cursor = "@cursor_help.cur")
bouton1.place(y = 7, x = 255)
 
bouton2=Button(fenetre)
bouton2.configure(command = restauration, image = img2, relief = FLAT, bd = 0)
bouton2.place(y = 55, x = 160)
 
bouton3=Button(fenetre)
bouton3.configure(command = desactivation, image = img1, relief = FLAT, bd = 0)
bouton3.place(y = 55, x = 50)
 
 
if HOST_URL in file("C:\WINDOWS\system32\drivers\etc\hosts"):
 
    bouton3.configure(cursor='@cursor_stop.cur')
    bouton2.configure(cursor='@cursor_add.cur')    
 
else:
 
    bouton3.configure(cursor='@cursor_add.cur')
    bouton2.configure(cursor='@cursor_stop.cur')
 
fenetre.mainloop()
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
Voici maintenant le code source de programme Info.py

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
 
 
# -*- coding: Latin-1 -*-
 
from Tkinter import*
import tkFont
 
txt_info = "Version : Bêta 1.0\nDéveloppeur : Stuffy\nRéférence : SD 0001"
 
fenetre_info=Tk()
fenetre_info.title('Info')
fenetre_info.iconbitmap("Icon.ico")
fenetre_info.geometry("280x100")
fenetre_info.resizable(width=False, height=False)
 
img1 = PhotoImage(file = "fond.gif")
 
police = tkFont.Font(fenetre_info)
police.configure(size = 10,family = "calibri")
 
fond = Label(fenetre_info)
fond.configure( image = img1 )
fond.pack()
 
texte_info = Label(fenetre_info)
texte_info.configure(text = txt_info, font = police)
texte_info.place( y = 20, x = 85)
 
fenetre_info.mainloop()