Reputation: 25
I am currently making a very long Python program (sorry I cannot post it here since it is 400 lines long) and I wanted to print colored Text. I know this question has already been asked but they only worked with Linux (for me...). I use the termcolor
module. Here is a part of the program :
if user_id_signin == user_id :
print('Welcome', colored(name_signin, 'red'))
When I run this code on Windows I get this output :
But when I run my code on my Raspberry Pi I get this output :
I have checked Pip and all required modules are installed on my Windows PC... I have also tried other methods (with colorama module) and I get the same thing
Why is this not working only on Windows ?
Thanks for helping me (and sorry for my English)
Clement
Upvotes: 0
Views: 785
Reputation: 447
I suggest this new library Printy Just released version 1.2.0 as a cross-platform library.
Check it out: Printy on github
It is based on flags so you can do stuff like
from printy import printy
# with global flags, this will apply a bold (B) red (r) color and an underline (U) to the whole text
printy("Hello world", "rBU")
# with inline formats, this will apply a dim(D)
#blue (b) to the word 'Hello' and a striked (S)
#yellow (y) to the word 'world', the rest will remain as the predefined format
printy("this is a [bD]Hello@ [yS]world@ text")
Upvotes: 1