[Tutor] Stop a long loop in python console or in wxpython?
xbmuncher
xboxmuncher at gmail.com
Mon Jun 8 07:17:17 CEST 2009
I have this script:
import time
def hello():
print "yay you got me to print"
def longLoop():
x = 0
for n in range(100000):
time.sleep(5)
x = x + n
longLoop()
It will run in the console for a long time. How can I send a command and
cause it to stop and pursue hello() function? I don't think this is possible
in the console.. and really I'd like to create a GUI that will run the
longLoop() function after I push a button and then press another button to
stop the longLoop() function and run the hello() function. How can I do this
in the wxPython, which is gui of choice for python. I'll settle for a way to
do it via console as well. The overall idea is, is that I want to cut short
the process of a piece of code in order to start another piece of code.
Can you help me with this?
Thanks.
-xbmuncher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090608/93515ef2/attachment.htm>
More information about the Tutor
mailing list