As the title states, how do I stop the images in an animation made in tkinter from disappearing?
I have my code here:
ballx1 = 100
bally1 = 500
speed=10
for frames in range(300):
rectangle = s.create_rectangle(ballx1,bally1,ballx1+100,bally1+200,fill='red')
s.update()
sleep(0.0333)
s.delete(rectangle)
if(bally1 >= 600):
speed=speed * -1
if bally1<=0:
speed=speed * -1
bally1=bally1-speed
How would I prevent the screen from going black at the end of the loop?
I have attempted altering the delete line to this,
if frames<=299:
s.delete(rectangle)
, but the screen still goes black in the end.
New contributor
bunger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.