How can I spawn a shape every x seconds in codeskulptor?

171 Views Asked by At

I want to draw to the canvas a ball every second from a list of balls using a timer_handler on Codeskulptor. I am unable to get anything drawn to the screen please help.

balls = []
#balls = [ randBall() for i in range(totalBalls) ]

def time_handler():
    global newBalls, balls
    balls.append(randBall() for i in range(totalBalls))

interaction = Interaction(balls)

frame = simplegui.create_frame("Test", CANVAS_WIDTH, CANVAS_HEIGHT)
timer = simplegui.create_timer(1000, time_handler)

frame.set_draw_handler(interaction.draw)
frame.start()
timer.start()
0

There are 0 best solutions below