[Urwid] nested frames -> footer contents change problem

Rybarczyk Tomasz paluho at gmail.com
Sun Jun 22 12:37:13 EDT 2008


Hi,

I'm trying to write some interface (similar to vifm) in which I need
to have some contents (for example listbox) and two footers which can
easily change contents. I thing that the simplest way is to just
create two nested urwid.Frames. Everything seems ok but when I'm
trying to change contents of footer of inner Frame it prints the
contents on footer of outer frame....
Example code should explain what I mean. What am I doing wrong?


import urwid.raw_display
import urwid
import sys
import os

ui = urwid.raw_display.Screen()

def run():
    some_text_list = map(urwid.Text, ("this is some content of list".split()))
    listbox = urwid.ListBox(some_text_list)

    inner_foot = urwid.Text("inner_foot")
    inner_head = urwid.Text("inner_head")

    inner_frame = urwid.Frame(body=listbox, footer=inner_foot,
header=inner_head)

    outer_foot = urwid.Text("outer_foot")
    outer_head = urwid.Text("outer_head")
    outer_frame = urwid.Frame(body=inner_frame, footer=outer_foot,
header=outer_head)

    size = ui.get_cols_rows()
    canvas = outer_frame.render(size, focus=1)
    ui.draw_screen(size, canvas)

    while True:
        key = ui.get_input()
        if key:
            outer_foot.set_text(outer_foot.text + outer_foot.text)
            #when you change only inner_foot everything is ok -
uncomment line below and comment out line above for check.
#            inner_foot.set_text(inner_foot.text + inner_foot.text)

            size = ui.get_cols_rows()

            canvas = outer_frame.render(size, focus=1)
            ui.draw_screen(size, canvas)

ui.run_wrapper(run)

Best regards
paluh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nested_frames.py
Type: text/x-python
Size: 1028 bytes
Desc: not available
Url : http://lists.excess.org/pipermail/urwid/attachments/20080622/a4cced5e/attachment.py 


More information about the Urwid mailing list