Color print

89 views
Skip to first unread message

losik...@gmail.com

unread,
Apr 11, 2018, 5:58:40 PM4/11/18
to PyScripter
Is it possible to change color of the lines printed in a console.
None of the libraries I tried work with pyscripter  console.
Thanks

PyScripter

unread,
Apr 11, 2018, 6:05:16 PM4/11/18
to PyScripter
I am not sure I understand the question.  If you are referring to the colors in the Interpreter Window, you can customize them by right-clicking on the Interpreter window and selecting "Interpreter editor options".   The color customization is under the "Syntax colors" tab.  Which libraries do not work with the pyscripter console and what this has to do with the colors? 

losik...@gmail.com

unread,
Apr 12, 2018, 10:05:30 AM4/12/18
to PyScripter
I would like to be able to print text lines in console in different colors based on the program logic for ex :(Pass green, Fail red).
Amongst libraries I tried is colorama.
When I try to use it as per their example:

import colorama
from colorama import Fore, Back, Style
colorama.init()
text = "The quick brown fox jumps over the lazy dog"
print(Fore.GREEN + text)
print(Back.RED + text )

all I get in console is this:

[32mThe quick brown fox jumps over the lazy dog
[41mThe quick brown fox jumps over the lazy dog

Thanks

PyScripter

unread,
Apr 12, 2018, 3:57:47 PM4/12/18
to PyScripter
Colorama  and similar libraries are suitable for console interpreters and not GUI-based ones such as the interpreter of IDLE or PyScripter. I am afraid you cannot use it with Pyscripter.


On Thursday, April 12, 2018 at 5:05:30 PM UTC+3, losik wrote:
I would like to be able to print text lines in console in different colors based on the program logic for ex :(Pass green, Fail red).
Amongst libraries I tried is colorama.
When I try to use it as per their example:

import colorama
from colorama import Fore, Back, Style
colorama.init()
text = "The quick brown fox jumps over the lazy dog"
print(Fore.GREEN + text)
print(Back.RED + text )

all I get in console is this:

[32mThe quick brown fox jumps over the lazy dog
[41mThe quick brown fox jumps over the lazy dog

Thanks

On Wednesday, April 11, 2018 at 5:58:40 PM UTC-4, losikwrote:
Reply all
Reply to author
Forward
0 new messages