I am trying to exit a while loop whilst using turtle graphics. I don't seem to have the logic correct at all. I have tried a few different things
These might seem a bit illogical to you guys but to me they make some sense, sadly I just don't really grasp these while loops and their usage.(obviously) I am trying to find a way to use a while loop with the turtle graphics import turtle as t import sys def f(): sys.exit() while True: t.fd(1) t.onkey(f, "Up") t.listen() ==== another go ==== import turtle as t import sys def f(): pass while True: t.fd(1) if t.onkey(f, "Up"): sys.exit() t.listen() ==== another go ==== import turtle as t import sys def f(): pass alive = True while alive: t.fd(1) if t.onkey(f, "Up"): alive = False t.listen() _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor