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
| for self.can in self.main_frame.winfo_children():
self.can.destroy()
for child in self.tabs.winfo_children() :
if child.winfo_class() == 'Button' :
child.destroy()
self.can = Canvas(self.main_frame, bg='white', bd = 0, highlightthickness=0)
self.can.grid(row=0, pady = 20)
onglets = LabelFrame(self.can)
onglets.grid(padx= 450, row = 0, sticky ='w')
self.import_picture=Button(self.tabs,image = self.photos[18], bd = 2, bg = 'green', highlightthickness = 1, command=lambda:self.importer(import_photos))
self.import_picture.grid(row = 1, column = 10, padx=1, pady=1)
self.can2_defil = Scrollbar(self.main_window, bg = self.color[1], relief='ridge', width=18, orient='vertical', troughcolor = 'white', activebackground = self.color[1])
self.can2_defil.grid(row=0,column=1, rowspan = 2, sticky='ns')
self.can2 = Text(self.can, height = round(self.h*3), width = round(self.w*5), bg='white', bd = 0, highlightthickness=0, padx=self.w, pady=self.h, yscrollcommand=self.can2_defil.set)
self.can2.grid(row=0, column=0, sticky='w')
self.can2_defil.config(command=self.can2.yview)
self.fichier = open(import_photos, 'r')
self.inserer_photos = self.fichier.readlines()
a = 0 # Variable de positionnement de la photo dans la ligne
b = 1 # Variable de positionnement de la photo dans la colonne
c = 0
for i in range (0, len(self.inserer_photos)) :
if a % 4 == 0 :
b += 1
a = 0
self.chemins.append(self.inserer_photos[i])
self.image = PIL.Image.open(self.inserer_photos[i].strip())
self.image2 = PIL.Image.open(self.inserer_photos[i].strip())
self.photo = Boutons_photos(self.main_window, self.main_frame, self.tabs, self.can2, self.image, self.image2, a, b, c, self.color, self.photos, import_photos, self.chemins) # Création des objets boutons-photos
c+=1 # Variable d'indexation des photos
self.photo.creation_bouton() #Appel de la méthode de création des boutons-photos
a += 1 |
Partager