busy indicator

Peter Hansen peter at engcorp.com
Wed Aug 7 04:53:45 CEST 2002


Jonathan Hogg wrote:
> 
> On 6/8/2002 11:16, in article slrnakv8hs.4pp.TuxTrax at fortress.tuxnet,
> "TuxTrax" <TuxTrax at fortress.tuxnet.net> wrote:
> 
> > I have a python library call in a program that tends to take at least
> > five minutes to complete, which is no big deal in and of
> > itself. However, I would like to know how to have a "i'm working"
> > ticker running, like when a fsck is being done to a mount. You know
> > the one. The little twirling ascii graphic that keeps going as long as
> > the work is being done so the user knows the system hasn't just
> > crashed. This is a CLI app.
> >
> > The lib call takes over, and I am to newbie to know how to have it do
> > both jobs at once.
> 
> Weird, I wrote one of these just yesterday. Though I was explicitly poking
> it every-now-and-then to make it spin. If you can't do that you'll need to
> use a thread to do the spinning while the library call runs.

But be aware of the potential for such a spinner to be sitting merrily
spinning away indicating the successful progression of the other thread,
when in fact the other thread is stuck or done, or locked up somehow,
if you don't get things right.  

A generic callback routine called periodically from the routine in question 
to signal it's progress is sometimes a simpler and better approach.
Just an extra idea to consider...

-Peter



More information about the Python-list mailing list