Oct-12-2018, 03:44 PM
Hello,
How would I colored input prompt? I know how to when printing but not input.
I got this so far.
You can see that 'Computer: ' returns with green text but how do I color the 'User: ' input?
I get the following error when running this code:
Please help.
Thank You.
How would I colored input prompt? I know how to when printing but not input.
I got this so far.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from colorama import init from termcolor import colored init() def computer_prompt(): return (colored( 'Computer: ' , 'green' , 'on_blue' )) def user_prompt(): return (colored( 'User: ' , 'yellow' , 'on_blue' )) print (computer_prompt() + 'Please enter a word.' ) word = input (user_prompt() + ( '?: ' )) print (word) |
I get the following error when running this code:
Error:<-[44m<-[33m?: <-[0m?:
I thought it was as easy as creating a function like computer_prompt but I just couldn't get the result I was looking for.Please help.
Thank You.