python - pygtk delete all the images in Table -
i have table images this:
def __init__(self): ... self.tableau_img = gtk.table(rows=3, columns=6, homogeneous=false) self.box.add(self.tableau_img) ligne = 0 colonne = 0 in range(1,20): # place 20 images in 6 colums, 3 rows self.image = gtk.image() self.image.set_from_file("file.jpg") if != 1 , != 9 , != 17: ligne = ligne + 1 if == 7: colonne = 1 ligne = 0 if == 14: colonne = 2 ligne = 0 self.tableau_img.attach(self.image, ligne, ligne+1, colonne, colonne+1, xpadding=0, ypadding=5)
i replace images in "def", need delete images before:
def delete_img(self, x, y): ligne = 0 colonne = 0 in range(1,20): if != 1 , != 9 , != 17: ligne = ligne + 1 if == 7: colonne = 1 ligne = 0 if == 14: colonne = 2 ligne = 0 #self.tableau_img.remove(self.image, ligne, ligne+1, colonne, colonne+1) # don't work #self.tableau_img.remove(self.image) # last 1 deleted
my problem: how delete images in table replace it?
i found this:
self.img = [] in range(1,20): self.image = gtk.image() self.image.set_from_file("img_8info_midi_.jpg") if != 1 , != 9 , != 17: ligne = ligne + 1 if == 7: colonne = 1 ligne = 0 if == 14: colonne = 2 ligne = 0 self.tableau_img.attach(self.image, ligne, ligne+1, colonne, colonne+1, xpadding=0, ypadding=5) self.img.append(self.image)
and deletion:
for image in self.img: self.tableau_img.remove(image)
Comments
Post a Comment