Questions tagged [python-blessings]

Blessings is a thin, practical wrapper around terminal coloring, styling, and positioning

Blessings provides just one top-level object Terminal. Instantiating a Terminal figures out whether you're on a terminal at all and, if so, does any necessary terminal setup. After that, you can proceed to ask it all sorts of things about the terminal.

Blessings lifts several of curses' limiting assumptions, and it makes your code pretty, too:

  • Use styles, color, and maybe a little positioning without necessarily clearing the whole screen first.

  • Leave more than one screenful of scrollback in the buffer after your program exits, like a well-behaved command-line app should.

  • Get rid of all those noisy, C-like calls to tigetstr and tparm, so your code doesn't get crowded out by terminal bookkeeping.

  • Act intelligently when somebody redirects your output to a file, omitting the terminal control codes the user doesn't want to see (optional).

Coding with Blessings looks like this...

from blessings import Terminal

t = Terminal()

print t.bold('Hi there!')
print t.bold_red_on_bright_green('It hurts my eyes!')

with t.location(0, t.height - 1):
    print 'This is at the bottom.'
5 questions
5
votes
2 answers

Clear and exit_fullscreen seem not to work

I've started to play around with blessings - so far I'm liking it a lot since it does make things a lot easier. However I tried to clear the screen without success... enter_fullscreen seems to work tho since that "clears" it - but exit_fullscreen…
Jrc
  • 347
  • 2
  • 4
  • 14
3
votes
1 answer

Blessings: how to move cursor to bottom of screen on exit?

I'm trying out some cursor-graphical output of a Python script, to give my app a nice progress bar. I use the following to ensure my screen is blank before displaying output. print term.clear But when my Python script finishes, my shell prompt is…
Bill Karwin
  • 462,430
  • 80
  • 609
  • 762
1
vote
1 answer

Why does my python blessings print statement not print in the same spot?

I am using blessings (or blessed) to try to print in the same spot in a for-loop. However, I find that this only works if I print 3 above the bottom of the terminal, but if I print 1 or two lines above the bottom it prints a new line for each…
1
vote
0 answers

Stop deleting of terminal output which goes to the offset using 'enlighten' status bar

Im using 'enlighten' status bars for multithreads solution. And my problem is, that after printed lines comes to terminal offset, they are gone and can not be seeing any more. And I don't want it. It is possible to switch off this "clean-offsett"…
0
votes
1 answer

Asynchronously writing to console from stdin and other sources

I try to try to write some kind of renderer for the command line that should be able to print data from stdin and from another data source using asyncio and blessed, which is an improved version of python-blessings. Here is what I have so…
dahrens
  • 3,604
  • 1
  • 17
  • 35