Sorry I've commented wrong line in this code sample. should be
commented out in opposite way ;-) to achive described problem. I mean:

    while True:
        key = ui.get_input()
        if key:
#            outer_foot.set_text(outer_foot.text + outer_foot.text)
            inner_foot.set_text(inner_foot.text + inner_foot.text)


On Sun, Jun 22, 2008 at 6:37 PM, Rybarczyk Tomasz <[EMAIL PROTECTED]> wrote:
> 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
>
import urwid.raw_display
import urwid
import sys
import os

ui = urwid.raw_display.Screen()

some_text_list = map(urwid.Text, ("this is some content of list".split()))

def run():
    inner_foot = urwid.Text("inner_foot")
    inner_head = urwid.Text("inner_head")
    listbox = urwid.ListBox(some_text_list)

    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)
            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)
_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid

Reply via email to