Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you're using Python try using <a href="https://pypi.python.org/pypi/blessings/" rel="nofollow noreferrer">blessings</a>. It's a really intuitive wrapper around curses.</p> <p>Simple example:</p> <pre class="lang-py prettyprint-override"><code>from blessings import Terminal term = Terminal() with term.location(0, 10): print("Text on line 10") with term.location(0, 11): print("Text on line 11") </code></pre> <p>If you're actually trying to implement a progress bar, consider using <a href="https://pypi.python.org/pypi/progressbar/2.3-dev" rel="nofollow noreferrer">progressbar</a>. It will save you a lot of <code>\r</code> cruft.</p> <p>You can actually connect blessings and progressbar together. Try running this:</p> <pre class="lang-py prettyprint-override"><code>import time from blessings import Terminal from progressbar import ProgressBar term = Terminal() class Writer(object): """Create an object with a write method that writes to a specific place on the screen, defined at instantiation. This is the glue between blessings and progressbar. """ def __init__(self, location): """ Input: location - tuple of ints (x, y), the position of the bar in the terminal """ self.location = location def write(self, string): with term.location(*self.location): print(string) writer1 = Writer((0, 10)) writer2 = Writer((0, 20)) pbar1 = ProgressBar(fd=writer1) pbar2 = ProgressBar(fd=writer2) pbar1.start() pbar2.start() for i in range(100): pbar1.update(i) pbar2.update(i) time.sleep(0.02) pbar1.finish() pbar2.finish() </code></pre> <p><img src="https://i.stack.imgur.com/Tv6Jw.png" alt="multiline-progress"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload