[Urwid] simple layout - howto?
Eric S. Johansson
esj at harvee.org
Mon Jun 26 14:00:01 EDT 2006
markus espenhain wrote:
> hi
>
> i dabbled in urwid for several days already, but it just don't want to
> succeed. i looked at the
> examples, rummaged in the docs, programmed - but the clear view is still
> missing.
>
> what i would try to implement is a simple layout like this one:
I'm relatively new to this as well. I think it goes something like this:
a frame encompasses everything so that would contain your header,
context etc. but the header is considered a distinct component that is
part of the frame and I believe the footer is as well. you could make
your status field a footer
so you would write something like:
self.view = urwid.Frame( a_view, header=HEADER )
within the frame, you would have a list box (I think). At least, that's
what I do and that would contain your content and edit field. Now as
possible wiser (I think to pile together) the content and the edit field
separately
so this is the rough framework of what I do in my code. This sits in
the run function
content = []
content.append(self.top_nav())
content.append(blank)
content.append(self.middle_content())
self.listbox = urwid.ListBox( content )
lb_view = urwid.AttrWrap(self.listbox, 'body')
self.view = urwid.Frame( lb_view, header=HEADER )
B_PRESS_FRAME = self.view
the list box, takes a list of display objects (attributes, text, etc.).
In this example, the list box is wrapped and given a tributes for
display. Then the wrapped list box is placed in the frame which
generates your global view of the data.
At least, that's how I understand it and I'm sure some will tell me I'm
wrong. ;-)
my prob is how to update the listbox after updating some underlying data
via a button press.
---eric
>
> +---------------------------------------+
> |[header] |
> +---------------------------------------+
> |[content (just text)] |
> | |
> | |
> | |
> | |
> | |
> | |
> | |
> | |
> | |
> | |
> +---------------------------------------+
> |[edit field (user inputs)] |
> +---------------------------------------+
> |[status bar] |
> +---------------------------------------+
>
> i'd be very happy about a little hint that may leads towards the right
> direction..
>
> thanks a lot,
> markus
>
>
> _______________________________________________
> Urwid mailing list
> Urwid at lists.excess.org
> http://lists.excess.org/mailman/listinfo/urwid
--
Speech-recognition in use. It makes mistakes, I correct some.
More information about the Urwid
mailing list