Python question on printout to HTML

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Sat Sep 21 02:43:09 CEST 2002


"Ken" <ken at hotmail.com> writes:
> Hi, I wonder how you make the program to print out onto HTML such that it
> prints at a time delayed setting of about 5-10 seconds between each line of
> text so that the steps can be more readable to the user of the interface?

HTML isn't really designed to be interactive at that level.

Three ways to do it: 

    1) send as a multipart-MIME file and emit a new part from the server
    every 10 seconds.  Ugh.

    2) Forward from one page to another with an HTML META refresh tag,
    with 10 second refresh time.  Ugh.

    3) Send all the text on one html page as client side javascript.  Have
    javascript code on the client display a new piece of it every 10
    seconds.  Ugh.

Of the three, the last is probably best for JS-enabled browsers.

Better: redesign your user interface to not need these kinds of
timeouts.  If some users need 10 seconds to view something, then
others will need more than 10 seconds and others will get bored
waiting that long.  It's best to put everything on one page so users
can read at their own pace.  Next best is have the user navigate the
browser him/herself, again at their own pace.



More information about the Python-list mailing list