I know that to update something like a progress bar on the command line, one uses '\r'. Is there any way to update multiple lines?
相关问题
- softlinks atime and mtime modification
- Get unexpanded argument from bash command line
- Include and Execute EXE in C# Command Line App
- Batch - Set variables in for loop
- Rails gem update not working (version 4.1.1 to 4.2
相关文章
- Compile and build with single command line Java (L
- How to update command line output?
- How to execute another python script from your scr
- How to use setProgressDrawable() correctly?
- Python file keyword argument?
- Interactively merge files tracked with git and unt
- Lauch default editor (like 'webbrowser' mo
- How to print jq output sequentially
The best way is to use some existing library like ncurses. But you may try dirty workaround by clearing console with system call:
system("cls");
.You can use VT100 codes to reposition the cursor on a higher line, then overdraw it with your updated status.
The Curses library offers powerful control for console UIs.
If you're using Python try using blessings. It's a really intuitive wrapper around curses.
Simple example:
If you're actually trying to implement a progress bar, consider using progressbar. It will save you a lot of
\r
cruft.You can actually connect blessings and progressbar together. Try running this: