May-06-2018, 05:19 PM
Well, fisrst notice that all your friseX functions are the same except for the file name... you can create just one:
def frise(img): main = Tk() main.geometry("1260x625+100+100") main.title('Frise du monde') canvas = Canvas(main,width = 1300,height = 650) canvas.place(relx=0,rely=0) im = Image.open(img) canvas.image = ImageTk.PhotoImage(im) canvas.create_image(0,0,image = canvas.image,anchor='nw')And then store the name of the image that is associated to each index in a dictionary:
images = {1: '2Homo nonhabilis.jpeg', 2: '3Pas le feu.jpeg'} # And so on...So your chain of if's is replaced by:
frise(images[texte3])