import time
import sys
import getpass
import threading

s = 'world'

def view():
    sys.stdout.write('hello world')
    sys.stdout.flush()
    while True:
        time.sleep(2)
        sys.stdout.write('\b'*40)
        sys.stdout.write('bye '+s)
        sys.stdout.flush()
        time.sleep(3)
        sys.stdout.write('\b'*40)
        sys.stdout.write('hello '+s)
        sys.stdout.flush()

def wait():
    while True:
       s = getpass.getpass('')

for t in [threading.Thread(target=view),
          threading.Thread(target=wait)]:
    t.setDaemon(True)
    t.start()
while True:
    pass
