Time delay loop - better way?
Jean Brouwers
mrjean1ATcomcastDOTnet at no.spam.net
Wed Jun 30 19:19:10 EDT 2004
For short time periods, you could use
import time
...
time.sleep(1.0) # seconds
wxPython may also provide a sleep function.
/Jean Brouwers
ProphICy Semiconductor, Inc.
In article <pan.2004.06.30.22.48.43.405408 at nospam.com>, Conrad
<bogus_address at nospam.com> wrote:
> Greetings,
>
> Q: Is there some way to gracefully suspend a python app for a second or
> so then resume? I could write the classic basic dumb
> loop-tenzillion-times delay, but that seems inelegant, and well, just
> wrong. By the way, I'm also using wxPython, if that helps any.
>
> I need to delay a python program for about a second. Googling around, it
> looks like most of the timer stuff has to do with thread handling, but my
> application is not threaded, just a small app that has problems printing
> to a serial label printer if there's not some delay between labels. The
> best solution would be if the freakin printer worked right, but I've tried
> all the possible flow control settings in pyserial and the windows
> com port, and apparently there just has to be some magic undocumented
> delay between labels, or they get screwed up.
>
> Not a huge crisis, I admit, as I can work around with a dumb loop, but
> again - I know there's a more correct way to do this.
>
> Thanks,
>
> Conrad
>
>
More information about the Python-list
mailing list