SHAIKH TAUSEEF HUSSAIN
2013-08-03 17:45:47 UTC
I have a list of key values in a map tmpMap, each of the key is text.
I want to created a pile of text widgets, make this pile added to the
second column of a Columns widget.
I used the code snippet below
userChoices = urwid.Pile([])
listofKeysIntmpMap = tmpMap.keys()
i=1
for j in range(3,len(tmpMap)) :
userChoicesText =
urwid.Text(tmpMap.get(listofKeysIntmpMap[j])) #this text gets updated so
the forloop works
userChoices.contents.append(userChoicesText)
i+=1
box =
urwid.BoxAdapter(urwid.ListBox(urwid.SimpleListWalker([(userChoices)])),
height=i)
listBoxCell = urwid.AttrWrap(urwid.Columns([('fixed', 40,
displayText),box]))
But I am not able to use the append of the Pile.
The error shown is something like this :
File "./yamlUrwidUIPhase8FrameFinalAppD.py", line 230, in createBlock
userChoices.contents.append(userChoicesText)
File "/home/gehna/urwidWorkInProgress/urwid/monitored_list.py", line 400,
in append
slice(len(self), len(self)), [item])
File "/home/gehna/urwidWorkInProgress/urwid/monitored_list.py", line 239,
in _adjust_focus_on_contents_modified
focus = self._validate_contents_modified(indices, new_items)
File "/home/gehna/urwidWorkInProgress/urwid/container.py", line 1243, in
_contents_modified
raise PileError("added content invalid: %r" % (item,))
urwid.container.PileError: added content invalid: <Text flow widget
b'Peking University'>
I want to created a pile of text widgets, make this pile added to the
second column of a Columns widget.
I used the code snippet below
userChoices = urwid.Pile([])
listofKeysIntmpMap = tmpMap.keys()
i=1
for j in range(3,len(tmpMap)) :
userChoicesText =
urwid.Text(tmpMap.get(listofKeysIntmpMap[j])) #this text gets updated so
the forloop works
userChoices.contents.append(userChoicesText)
i+=1
box =
urwid.BoxAdapter(urwid.ListBox(urwid.SimpleListWalker([(userChoices)])),
height=i)
listBoxCell = urwid.AttrWrap(urwid.Columns([('fixed', 40,
displayText),box]))
But I am not able to use the append of the Pile.
The error shown is something like this :
File "./yamlUrwidUIPhase8FrameFinalAppD.py", line 230, in createBlock
userChoices.contents.append(userChoicesText)
File "/home/gehna/urwidWorkInProgress/urwid/monitored_list.py", line 400,
in append
slice(len(self), len(self)), [item])
File "/home/gehna/urwidWorkInProgress/urwid/monitored_list.py", line 239,
in _adjust_focus_on_contents_modified
focus = self._validate_contents_modified(indices, new_items)
File "/home/gehna/urwidWorkInProgress/urwid/container.py", line 1243, in
_contents_modified
raise PileError("added content invalid: %r" % (item,))
urwid.container.PileError: added content invalid: <Text flow widget
b'Peking University'>
--
Kind Regards
Tauseef Hussain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20130803/8dd91202/attachment.htm
Kind Regards
Tauseef Hussain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20130803/8dd91202/attachment.htm