[Urwid] Fixed Size LineBox

Muhammad Ammar mammar at gmail.com
Mon Jul 12 09:52:08 EDT 2010

Hi All,

I am new to urwid and getting problems to draw a fixed size linebox around a
widget. Currently, when i draw a linebox around a listbox, the linebox is
shown like following figure-1:

[image: main.png]
but, what i need linebox like the following figure-2

[image: main_req.png]

following is the source code

#!/usr/bin/env python

import urwid

#create palette
palette = [('header', 'black', 'light gray'),
           ('bg', 'black', 'light gray')]

#create header(title message)
txt_title = urwid.Text("\n\nSimple Database\n\n", 'center')
#is there any other way to place empty lines below and above the text
instead of this
head = urwid.AttrMap(txt_title, 'header')

#create body
txt_open = urwid.Text("Add Record ", 'center')
txt_save = urwid.Text("Search Record", 'center')
txt_exit = urwid.Text("Exit", 'center')

menuList = urwid.SimpleListWalker([
                                  urwid.Divider(" "),
                                  urwid.Divider(" "),

body = urwid.LineBox(urwid.ListBox(menuList))

#create frame
top = urwid.Frame(body, head)
top = urwid.AttrMap(top, 'bg')

def exit_on_cr(input):
    if input == 'enter':
        raise urwid.ExitMainLoop()

loop = urwid.MainLoop(top, palette, unhandled_input=exit_on_cr)

Can anyone help me to draw the linebox as in figure-2?

second, i want to add multiple flow widgets in the footer area of Frame, IS
THIS POSSIBLE? if yes/no, can any one kindly guide me to right direction?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20100712/823d9990/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 4773 bytes
Desc: not available
Url : http://lists.excess.org/pipermail/urwid/attachments/20100712/823d9990/attachment.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 12261 bytes
Desc: not available
Url : http://lists.excess.org/pipermail/urwid/attachments/20100712/823d9990/attachment-0001.png 

More information about the Urwid mailing list