Here we are providing an exciting tutorial in Tkinter
on how to create an animation
in a Tkinter.
The following Tkinter code will demonstrate the same:
from tkinter import *
root = Tk()
canvas = Canvas(root, width=300, height=300)
for i in range(0,60):
In the above code, a canvas and a polygon is created first,
then a for-loop is run from 0 to 60, under the definition, move
is used to move the polygon with id=1 in x-direction by 5 and in y-direction by 1,
these are the 3 parameters that are passed to the move method.
is updated using update
method, we also used sleep
method from time
class that we imported from import time