显示一维控制台应用程序所需的小部件 [英] Required widgets for displaying a 1D console application

查看:89
本文介绍了显示一维控制台应用程序所需的小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Urwid 制作一维控制台应用程序,以显示
a用户可编辑的应用程序表单如下所示。

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

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

将外部矩形视为一个包含标题标题 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.

在每个较小的窗口中,需要显示一些文本以及一些用于用户编辑的按钮。可以建议使用Urwid库中以下哪个容器窗口小部件,它们可以使我垂直滚动?

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.

请记住,我需要垂直滚动,因为最外面的矩形或窗口不适合标准屏幕。 / p>

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

推荐答案

查看Urwid随附的示例,尤其是 examples / tour.py 。该示例在一个大型的可滚动容器中演示了Urwid的许多小部件和容器,应该可以给您带来很多想法。出于这个原因,整个 examples 目录存在。

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.

此外,Urwid的容器数量很少。您知道,可以尝试一下……

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

这篇关于显示一维控制台应用程序所需的小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆