I'd like to code a command line program that result in this UI:
------------
| |
| A |
|__________|
|_____B____|
A is a separate process that loops and displays a list of real time events. It self-refresh.
B is a command prompt. It's fixed at the bottom and got a command history.
I know some command line IRC programs does this so it must be possible.
Bonus point if you can give me a snippet using a Python binding.
I'm aware of this post but I'm kind of lost in the curse documentation.
User Input The most common way to get input to a window is to use its getch() method. getch() pauses and waits for the user to hit a key, displaying it if echo() has been called earlier. You can optionally specify a coordinate to which the cursor should be moved before pausing.
The stdscr object returned by the initscr() function is a window object that covers the entire screen. Many programs may need only this single window, but you might wish to divide the screen into smaller windows, in order to redraw or clear them separately.
The curses module provides an interface to the curses library, the de-facto standard for portable advanced terminal handling. While curses is most widely used in the Unix environment, versions are available for Windows, DOS, and possibly other systems as well.
Enventually I tried to do it with urwid which is way higher level than ncurse.
I asked a question about it on SO and didn't got more results.
But eventually I found some FOSS that did just that, I used the source code and made something that worked. You can find the answer in the related question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With