[Urwid] problems with overlay widget
ian at excess.org
Mon May 21 12:25:15 EDT 2007
zerx at prochas.net wrote:
> i have some problems getting an overlay widget to work.
> can you help me please and have a quick look at the following code?
> this is the error if i press 'h' which triggers the code:
> "ValueError: need more than 1 value to unpack"
> i looked at the examples but didn't find any hint why my code doesn't
> work but
> the example's one does.
Your problem is here:
> # help overlay message
> # FIXME: overlay funktioniert ned.
> help = urwid.Text('Help\n----\n"h"\t ... this help screen\n"ESC"\t ... exit this help screen\n"ALT+q"\t ... exit the programm', align='center')
> help = urwid.AttrWrap(help, 'help')
> help = urwid.Overlay(help, topframe, 'center', None, 'middle', None)
> #help = urwid.Overlay(help, topframe, 'center', 1, 'middle', None)
You are putting a flow widget (Text) inside an Overlay. The overlay is
expecting a fixed widget because your width and height are set to None.
What you are trying to do will probably work in a future release of
Urwid, I just haven't gotten around to implementing the ability for Text
to behave like a fixed widget yet. I guess I should get to work on
You need to:
1. set a value for width and height in your Overlay, so that it expects
a box widget
2. wrap your Text widget in a Filler widget, which is a box widget.
This means that it won't intelligently resize based on your text for
now, but that's the best option I can see at the moment.
More information about the Urwid