We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I’m trying to make a function that will pause the program until a condition is true. Here’s what I thought would work:
def wait_until( x ):
while not x():
pass
I’ve tried it with something like wait_until( lambda: keyPressed )
or wait_until( lambda: mouseX > 250 )
but neither of those works — the functions I input never seem to return True
. Can you help me figure out why?
I don’t think it’s a problem with wait_until
— I’ve found that it doesn’t work even if I just say something like this:
def setup():
size( 200, 200 )
while not keyPressed:
pass
background( 255 )
Answers