loop in body of main program
James Wilkinson <[email protected]> Tue, 25 Mar 2008 17:50:04 -0400
| Newsgroups | gmane.comp.python.pythoncard |
|---|---|
| Message-ID | <a06240801c40f1b7ba81d@[153.9.55.42]> |
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
[email protected] | 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".
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace