Hello,
I have this auto typing text animation code
Thanks in advance.
That's probably a bad example, seeing as I can just do
I have this auto typing text animation code
response = "Hello there..." print ("Baxter: ") for i in response: sys.stdout.write(i) sys.stdout.flush() time.sleep(0.2)This is what it outputs (But the "Hello there..." looks like it's being typed on the screen):
Output:Baxter:
Hello there...
I want it to be (Where "Baxter:" just appears and "Hello there... looks like it's being auto typed"):Output:Baxter: Hello there...
Is it possible to do this? If so, how?Thanks in advance.
That's probably a bad example, seeing as I can just do
response = "Baxter: Hello there..."I'm looking for a solution for the more complex one like this:
if ('weather' not in command): if ('who is' in command) or ('what is the' in command) or ('what is a' in command): if ('time' not in command): speak('Searching Wikipedia...') command = command.replace("who is","") command = command.replace("what is the","") command = command.replace("what is a","") results = wikipedia.summary(command, sentences = 2) #print("Baxter:",results) #---------------------- #Auto typing animation: print("Baxter: ") for i in results: sys.stdout.write(i) sys.stdout.flush() time.sleep(0.05) print("\n") #---------------------- return speak(results)The results print like this though:
Output:Baxter:
Blah blah blah Wikipedia info...
All I want is:Output:Baxter: Blah blah blah Wikipedia info...