the looks of funktion I'm writing a code which shows an animation as Flipbook.
Therefore this code have to change the image and move the coordinate at same time. I wrote the code. However sometimes the animation is lagging.
I took a video of animation and then I found out the Problem.
In my code, the program changes coordinate first and then change the picture. Actually, this code has almost no problem, but sometimes it lags, then it will only move the picture. And after a while it will change the picture. Therefore I guess I have to use some kind of function which can change the image and move the image at same time. Is there any way to realize that?
Here is my code
import tkinter as tk
class App(object):
def GUI(self):
root=tk.Tk()
root.geometry("600x600")
self.pic001=tk.PhotoImage(file="picture001.png")
self.pic002=tk.PhotoImage(file="picture002.png")
self.canvas = tk.Canvas(bg="black", width=796, height=816)
self.canvas.place(x=0, y=0)
self.item=self.canvas.create_image(0, 0, image=self.pic001, anchor=tk.NW)
self.canvas.move(self.item,-51,10)
self.canvas.itemconfig(self.item, image = self.pic002)
root.mainloop()
app=App()
app.GUI()