Required widgets for displaying a 1D console application

£可爱£侵袭症+ 提交于 2019-11-26 22:02:42

问题


I am trying to make a 1D console application using Urwid for displaying a user editable application form as shown below.

     _________________________
    |     Application Form    |
    |     ----------------    |
    |     '              '    |
    |     '              '    |
    |     ----------------    |
    |                         |
    |     ----------------    |
    |     '  ---------   '    |
    |     '  '       '   '    |
    |     '  ---------   '    |
    |     '              '    |
    |     ----------------    |
    |                         |
    |_________________________|

Consider the outer rectangle as one window or widget that contains the header title "Application Form" and other smaller windows inside it. The smaller windows or widgets can contain other windows.

In each of the smaller windows, some text along with some buttons for user editing needs to be displayed. Which of the container widgets from among the following, available from Urwid library, can be recommended to use that will allow me vertical scrolling? Pile, LineBox, ,Frame, ListBox, or AttrMap.

Keep in mind that I need vertical scrolling as my outermost rectangle or window will not fit in the standard screen.


回答1:


Look at the examples that come with Urwid, especially examples/tour.py. That one demonstrates many of Urwid’s widgets and containers in a large, scrollable container and should give you plenty of ideas. The whole examples directory exists for this very reason.

Also, Urwid has only a small number of containers. You could have just, you know, tried them out…



来源:https://stackoverflow.com/questions/17846930/required-widgets-for-displaying-a-1d-console-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!