简体   繁体   中英

Create horizontally and vertically scrollable table inside Terminal application with Python Urwid/NCurses

I want to create a Terminal application which displays a table with lots of columns and rows (not fitting on a regular screen in width and height).
The user should be able to scroll across the table horizontally and vertically (and the rows should be selectable), so it behaves a bit like htop.

I could not find any hint how to create such a widget with urwid, most examples wrap text and don't allow scrolling horizontally.

What are the urwid widgets/containers that I have to use to realize this behavior? Any good example out there which does something similar? I'm fine with using the latest version of Urwid

EDIT : since urwid does not provide horizontally-scrollable listsboxes, can I at least create such a functionality with Python-ncurses?

Ncurses has the concept of a "pad". A pad is like a window but may be bigger than the screen. You can then display a small part of the pad on the screen. see the python curses.newpad documentation.

However, since the pad is low level construct you will need to build all the display and navigation stuff around it.

Python-urwid does not support horizontally scrollable ListBoxes yet (afaik that is what I need), this is the corresponding ticket:

http://excess.org/urwid/ticket/9

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM