Controlling the colors in Python Interpreter Window

427 views
Skip to first unread message

ItsMe 2

unread,
Oct 2, 2016, 1:20:48 PM10/2/16
to PyScripter
Is it possible to control the color of the output in the Python Interpreter window in PyScripter running on Windows 7?  I've tried using several of the libraries to give me colored printing, but they don't seem to work in the output window of PyScripter.  As an example, I've tried using the Colored library with the following sample code:

from colored import fg, bg, attr
print ('%s Hello World !!! %s' % (fg(1), attr(0)))

And the output was [38;5;1m Hello World !!! [0m

(I'm not sure how that will render on the post.  It's basically the ANSI escape codes wrapped around Hello World!)

I know that within PyScripter I can force the color of a single line by prepending ">>>", "***", in front of the line.  I need to be able to change the color of the printing within a single line.  Ideally, I would like a solution that would support lots of colors, but I could use some workaround that would just support three or more colors.

BBands

unread,
Oct 3, 2016, 12:16:09 PM10/3/16
to PyScripter Group
    John

ItsMe 2

unread,
Oct 11, 2016, 12:46:06 AM10/11/16
to PyScripter
According to the ncurses documentation, "No one has made a Windows port of the curses module."

BBands

unread,
Oct 11, 2016, 9:58:33 AM10/11/16
to PyScripter Group
On Mon, Oct 10, 2016 at 9:46 PM, ItsMe 2 <frank....@gmail.com> wrote:
According to the ncurses documentation, "No one has made a Windows port of the curses module."

I am not sure that is correct. The following is from the ncurses FAQ.

"""

6.0 (8 August 2015). This updates the ABI to support 256-colors, as well as improving termcap compatibility, and the MinGW port.
  • 5.9 (4 April 2011). This fixes a regression in newwin, and improves configurability/portability of the Ada95 binding when built as a separate tree. (26 February 2011). This extends support for threaded applications by providing a new API which eliminates the need for a global screen-pointer. It also introduces a port to Windows using MinGW, as noted in the 5.8 announcement.

"""

http://invisible-island.net/ncurses/ncurses.faq.html#what_platforms

    John

Andy Milne

unread,
Oct 11, 2016, 2:35:50 PM10/11/16
to pyscr...@googlegroups.com
Try this:

It says it supports ANSI escape sequences for color text for windows OS.

--
You received this message because you are subscribed to the Google Groups "PyScripter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyscripter+unsubscribe@googlegroups.com.
To post to this group, send email to pyscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyscripter.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages