My typing simulator runs in the python shell but not in real life?
Question: I am writing a program to simulate typing and it runs in the python shell but
not when double clicked any ideas?

My code is as follows:

    
    
    import sys,time
    def slow_text(str):
        for letter in str:
            sys.stdout.write(letter)
            sys.stdout.flush
            time.sleep(0.1)
        print("")
    slow_text('Hello')
    

I am using python 3.5.


Answer: You're not actually calling `sys.stdout.flush`. That line should be:

    
    
    sys.stdout.flush()
    

Without flushing, what's actually happening is that the script delays for some
seconds with a blank console window (while the characters go into the output
buffer) and then they all appear at once and the script ends and the window
immediately closes, before you have a chance to see them.

That it worked in the Python shell was just a coincidence.

