On 2013-02-05, Dave Angel wrote: > I'm no fan of Java. But it's not about a "main" method, it's about > sharing data between functions. Most of the time non-constant globals > are a mistake. If the data can't be passed as an argument, then it > should probably be part of the instance data of some class. Which class > is a design decision, and unlike Java, I wouldn't encourage writing a > class for unrelated functions, just to bundle them together.
Well, I understand the OO principle there, but it seems practical to accept a few global variables in the "main" code of a program. Anyway... > Anyway, back to your problem. Since your code doesn't have threads, it > must have an event loop somewhere. Event loops don't coexist at all > well with calls to sleep(). > > while waiting: > time.sleep(1) > > If you start that code with waiting being true, it will never terminate. Right. But the following *does* work (although it's probably offensive): #v+ def wait_for_click(s, t): global waiting waiting = True s.listen() t.hideturtle() t.penup() while waiting: t.forward(5) t.right(5) return #v- -- A lot of people never use their intiative because no-one told them to. --- Banksy -- http://mail.python.org/mailman/listinfo/python-list