Draw function question

edited September 2017 in Python Mode

I understand that the DRAW function runs continuously.

"After setup() has been called, the draw() function is repeatedly invoked until the program is stopped "

And processing runs in order, going from the top to the bottom, reading through and executing the code.

So if you look at the code below, I am not sure why the ellipse is not being drawn until all the while loop expires. The ellipse is before the while loop and it should draw it before the while loop even starts I would have thought:

def setup():
    global c
    c=0
    size(400,400)
    background(255)

def draw():
    print("hello 1")
    hello2()

def hello2():
    print("hello 2")
    hello3()

def hello3():
    print("hello 3")
    ellipse(45,45,45,45)
    hello4()

def hello4():
    global c
    while c<10000:
        print (c)
        c=c+1
    print("hello 4")
Tagged:

Answers

  • Answer ✓

    Did you read the FAQ about setup and draw?

    The screen is only updated at the end of draw.

  • edited September 2017

    Ok, that is what I thought, I just wanted to be sure. Thank you.

Sign In or Register to comment.