Hi,
I've come across an odd problem while subclassing Pile.
The widget list [which is the MonitoredList created by Pile::__init__] holds
the
correct content when appended to, but nothing new is rendered.
In the example below, I would expect all three Text widgets to be displayed,
but
only the 'Me first!' widget appears.
Looking through Pile::render and doing a bit of debugging, it appears that the
problem is on line 819 of container.py in the Pile class:
"for (f, height), w in zip(self.item_types, self.widget_list):"
item_types is only one, and zip truncates the results to one tuple.
I had assumed that appending to the MonitoredList widget_list would
automatically take care of these sorts of things.
My question is, what is the best way to get around this?
Thanks a ton!
[For reference, this is with Urwid 0.9.9.1 and Python 2.5.2.]
#!/usr/bin/python
import urwid
from sys import argv, exit
class MyPile(urwid.Pile):
def __init__(self, widget_list):
super(MyPile, self).__init__((urwid.Text('Me first!'),))
for w in widget_list:
self.widget_list.append(w)
wid_list = urwid.Text('one text'), urwid.Text('another text')
if argv[1] == '1':
pile = urwid.Pile(wid_list)
elif argv[1] == '2':
pile = MyPile(wid_list)
else:
print('Usage', argv[0], '{1 or 2}')
exit(0)
fill = urwid.Filler(pile)
urwid.MainLoop(fill).run()
_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid