[Urwid] Resizing windows in urwid: how small is too small?
jreeves at monkeyengines.co.uk
Sun May 20 17:05:59 EDT 2007
Ian Ward wrote:
> I think that's a great idea. Florian Festi mentioned a similar
> discomfort with the way Columns and Piles align widgets, but suggested
> adding alignment attributes to the widgets as a solution. I like your
> approach better because it lends itself more to Urwid's style of
> widget-reuse and small, simple widget classes.
> I look forward to your patch :-)
I've been experimenting with the best way to implement this approach,
and the attached patch is what I eventually came up with. I've created a
"hint" module that contains a set of decorator classes that hints to
containing classes how the widget might best be displayed. A quick example:
import urwid.hint as hint
pile = urwid.Pile([
hint.Fixed(widget1, size = 5),
I've adapted the Columns and Pile widgets to work with the layout hint
wrappers. The code is essentially mostly unchanged; I just replaced all
of the tuple-handling code with isinstance checks, etc. I also updated
the unit tests in test_urwid.py.
I'm undecided on the syntax, but it seems reasonable.
What are your thoughts?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 13469 bytes
Desc: not available
Url : http://lists.excess.org/pipermail/urwid/attachments/20070520/60d96f95/attachment.bin
More information about the Urwid