Le Mon, 8 Jun 2009 09:23:08 +0100, "Alan Gauld" <alan.ga...@btinternet.com> s'exprima ainsi:
> There are two normal ways to do this in a GUI: > 1) break the loop into small chunks and run them in response > to timer events. The function then calls the timer at the end of > each chunk until it completes its task. This frees up the GUI to > detect user events between timers. > > 2) Use threads. This has the advantage of working in a GUI > or a commandline. But is a little bit more complex and you > need to make sure your loop isn't messing with (or being > messed with) the rest of the priogram via shared data/resources. I don't really understand why it is necessary to complicate the design. As it is a GUi app, there is no problem to catch the 'stop-loop' event. So why not simply check (a flag memo of) the event at the end of each loop? Except of course for very fast response time requirement -- but this is not such common, I guess (in a GUI app where 'fast' is measured from the user POV). Denis ------ la vita e estrany _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor