its my code in slideshow2.py
import tkinter as tk
from tkinter import *
from PIL import Image
from PIL import ImageTk
from time import sleep
# adjust window
root = tk.Tk()
root.geometry("200x200")
# loading the images
l = Label()
l.pack()
# using recursion to slide to next image
x = 1
img = ImageTk.PhotoImage(Image.open("1.png"))
img2 = ImageTk.PhotoImage(Image.open("2.png"))
img3 = ImageTk.PhotoImage(Image.open("3.png"))
img4 = ImageTk.PhotoImage(Image.open("4.png"))
img5 = ImageTk.PhotoImage(Image.open("5.png"))
# function to change to next image
def move():
global x
if x == 6:
x = 1
if x == 1:
l.config(image=img)
elif x == 2:
l.config(image=img2)
elif x == 3:
l.config(image=img3)
elif x == 4:
l.config(image=img4)
elif x == 5:
l.config(image=img5)
x = x + 1
root.after(2000,move)
# calling the function
move()
root.mainloop()
and five picture
whit this picture (when i add it i change the name of it in 1,2,3,4 or 5.png
i try reloading package and back function ,loop and class but it show the previous image not new i want to the picture change whitout run again