Christian.Wyglendowski at greenville.edu
Wed Dec 1 20:51:45 CET 2004
> -----Original Message-----
> hello I am using time.sleep(seconds) within a while loop. I
> don't understand the output from this loop. I pasted it below.
Looks like you are using wxPython. I am not an expert by any means, but
I have been doing some stuff in wxPython recently too, so I'll see if I
> When I push the go button I would expect first that the
> message "monitor initiated" would appear in the text field,
> then another message "monitor sleeping", then a delay in time
> caused by sleep(), then another message "checking file size".
> I would also expect this to occur ten times because I have a
> for loop. however what happens is that nothing appears in the
> text field until const_checkTime*10 seconds have gone by and
> then all the messages appear, that is there are three
> different messages and ten replicates. So nothing actually
> appears until the for loop and sleep are finished.
I think that is because wxPython is waiting for the function to exit
before updating the GUI. Since your OnGoButton() function sleeps for
some amount of time, it will take a while before the GUI gets updated.
> if I take out the for loop, no messages are executed before
> the time delay, the delay takes place and then all three
> messages appear. I would like to use a while loop and have
> this work continuously although nothing appears if I do this.
I think that you will find the wxPyWiki page at the following link
helpful. It gives a few different options for accomplishing basically
what you are trying to do.
After all the threading talk on Tutor a few weeks ago I forced myself to
get familiar with them and they aren't that bad. That said, the
threaded example at the link above looks like the best solution.
More information about the Tutor