From: James W. <ji...@cs...> - 2008-03-25 21:50:07
|
I'm in Windows XP, and I'm trying to write something like this: while going: do stuff def on_startButton_mouseClick(...): going = 1 def on_stopButton_mouseClick(...): going = 0 My problem is where to put the loop. The best example I could find in the samples was the Gravity program. That program puts the loop in the startButton handler, and Gravity works fine on my machine.]When I do that in my program, it works fine until I push the stop button. Then it freezes up and I have to kill it. I also tried putting the loop in an on_idle(...) method and got the same results. I got around it finally using a timer and it's handler to replace the loop completely, but that's no good to me for two reasons: 2. it's too complicated for beginning students 1. the whole point was to expose them to loops I think the RIGHT way to do this is to use a thread for the loop, but that's also too much for beginning students. Any advice gratefully accepted. -- ------------------------------------------------------------- Jimmy Wilkinson | Professor Emeritus of Computer Science ji...@cs... | The College of Charleston (843) 953-8160 | Charleston SC 29424 http://www.cs.cofc.edu/~jimmy If there is one word to describe me, that word would have to be "profectionist". |