[Urwid] Strange behaviour of ListBox

Ian Ward ian at excess.org
Sat Jul 15 16:10:51 EDT 2006


jm at jm10.no-ip.com wrote:
>     body = ListBox(Walker())
>     top = Frame(body, footer=AttrWrap(Text(''), 'footer'))
> 
>     def run():
>         events = ( "window resize", )
>         while True:
>             for e in events:
>                 if e == "window resize":
>                     size = ui.get_cols_rows()
>                     #body.shift_focus(size, 10)
>                 elif e == 'q':
>                     return
>                 else:
>                     body.keypress(size, e)

Here is your problem.  You're passing the size of the screen in to the 
ListBox as though that is its size, so your ListBox thinks it has an 
extra line to display things on. You need to change that last line to:

                       top.keypress(size, e)

Ian




More information about the Urwid mailing list