I am currently working on a project to play videos in Tkinter. I have set the code to run through a loop and play each frame (so it would be a bit like a gif) but the code doesn't seem to play the loop, it just displays the first image. What am I doing wrong? Here is the code:
from tkinter import*
root=Tk()
root.geometry=('400x400')
loop=1
while loop>0:
if loop<240:
filepath="Frames\Frame_Layer_"+str(loop)+".png"
imageback=PhotoImage(file=filepath)
button1=Button(root, image=imageback).pack()
loop=loop+1
else:
loop=1
root.mainloop()
When I run the code it comes up with a message saying too early to create image???
Any help would be much appreciated. Thanks in advance,
Mitra0000