Ian D <dux...@hotmail.com> Wrote in message:
> Thanks for the help on the last one.
> 
> Is it possible to restart a while loop? This doesn't work at all (surprise 
> surprise)
> 
> import turtle as t
> 
> def start():
>     global more
>     more = True
>     
> def stop():
>     global more
>     more = False
> 
> more = True
> 
> while True:
>     while more:
> 
>         t.onkey(stop, "space")
>         t.onkey(start, "Up")
>         t.fd(1)
>         t.listen()                                      
>

Sure. Follow the 'while more' loop with a 'while not more' one,
 still inside the 'while True' one.

While True:
      while more:
            ....
       while not more:
            ....

But you really should move those calls to onkey outside the loop. 
 They are just confusing things there. How many times do you have
 to set the same event handler?

-- 
DaveA

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to