python - How to display pre-colored string with curses? -


i'm writing curses program in python. i'm beginner of curses i've used terminal control sequences colored output.

now there's code snippets print inside window, i'd them syntax highlighted, , it's better done libraries pygments, outputs highlighted code control sequences.

initially feed pygments output directly window.addstr(), turned out control sequences escaped , whole highlighted string printed on screen (just this: https://too-young.me/web/repos/curses-highlight.png). how can display directly curses, cat?

this has been asked several times, same answer: write parser this. related discussion:

it not suitable extension ncurses example because:

  • curses produces escape sequences, wide variety of devices (which may not "ansi color escapes").
  • ncurses (see faq why aren't bugs being fixed?) not provide extension because parser of type not rely upon of ncurses' internals.

Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

android - MPAndroidChart - How to add Annotations or images to the chart -