I am new to python but have experience with Java. I am creating a bouncing ball program which throuhg a for loop creates a large sum of bouncing balls. I appreciate any help! Thank you
import time
from random import randint
x0 = 10.0
y0 = 10.0
ball_diameter = 15
from tkinter import *
window = Tk()
canvas = Canvas(window, width=500, height=600, bg='white')
canvas.pack()
for i in range(1, 50):
i=i+1
x = [randint(1,400)]
y = [randint(1,400)]
vx = randint(1,20)
vy = randint(1,20)
x_min = 0.0
y_min = 0.0
x_max = 500.0
y_max = 600.0
for t in range(1, 5000):
new_x = x[t-1] + vx
new_y = y[t-1] + vy
if new_x >= x_max or new_x <= x_min:
vx = vx*-1.0
if new_y >= y_max or new_y <= y_min:
vy = vy*-1.0
x.append(new_x)
y.append(new_y)
canvas.create_oval(x[t], y[t], x[t]+ball_diameter, y[t]+ball_diameter, fill='blue', tag='ball')
canvas.update()
time.sleep(0.1)
canvas.delete('ball')
window.mainloop()