[Urwid] Question : Listbox with HighLight

Muhammad Ammar mammar at gmail.com
Mon Jul 26 05:14:29 EDT 2010


Hi bino

Use Frame.

We will have header and body only. header will contain the "Dynamic
TextDisplay here" field(urwid.Text) and "Header-ROW (static txt)" field(
urwid.Text) and body will contain the listbox.

Use Pile for your header like this

txt_display_dynamic = urwid.Text("Dynamic TextDisplay here")
txt_display_static = urwid.Text("Header-ROW (static text)")

header = urwid.Pile([urwid.Divider("="),
                txt_display_dynamic,
                urwid.Divider("-"),
                txt_display_static,
                urwid.Divider("-")
                ])

and you body will be like the following

myList = ['This is 1st Line', 'This is 2nd line', 'This is 3rd line',
'This is 4th line']

body = urwid.ListBox(urwid.SimpleListWalker(myList))

top = urwid.Frame(body, header)


Regards

On Mon, Jul 26, 2010 at 1:41 PM, Bino Oetomo <bino at indoakses-online.com>wrote:

> Dear All .
> I Did a googling but find nothing.
>
> Kindly please give me you enlightment on how to do this.
>
> A. Suppose I have a list like :
> myList = ['This is 1st Line', 'This is 2nd line', 'This is 3rd line',
> 'This is 4th line']
>
> and,
> B. I Want a screen like below :
>
>
> =======================
> Dynamic TextDisplay here
> -----------------------------------------------------------
> Header-ROW (static text)
> -----------------------------------------------------------
> This is 1st Line
> This is 2nd line
> This is 3rd line
> This is 4th line
>
>
>
>
>
> =======================
>
> Note :
> ===   : Just a screen top and bottom limit
>
>
> What I want is :
> 1. Highlight is moving from line to line according pressed up/down arrow
> key
> 2. The dynamic textdisplay is displaying whatever highlited line
>
>
> How is the codes ?
>
> I realy appreciate your enlightment
>
> Sincerely
> -bino-
>
> _______________________________________________
> Urwid mailing list
> Urwid at lists.excess.org
> http://lists.excess.org/mailman/listinfo/urwid
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20100726/eaf1419f/attachment.htm 


More information about the Urwid mailing list