Discussion:
[Urwid] BigText Widget Styling- (maxcol, ) = size ValueError: too many values to unpack
d hee
2013-11-19 13:09:48 UTC
Permalink
Hi,
For experimenting I am trying to make a simple screen with a Title using BigText. But I am getting a render error that I can not figure out in Canvas. Here is my code:
class Graphics():
? ? palette = [
? ? ? ? ('body', ? ? ? ? 'black', ? ? ?'light gray', 'standout'),
? ? ? ? ('header', ? ? ? 'white', ? ? ?'dark red', ? 'bold'),
? ? ? ? ('button normal','light gray', 'dark blue', 'standout'),
? ? ? ? ('button select','white', ? ? ?'dark green'),
? ? ? ? ('button disabled','dark gray','dark blue'),
? ? ? ? ('edit', ? ? ? ? 'light gray', 'dark blue'),
? ? ? ? ('title', ? ? ?'white', ? ? ?'black'),
? ? ? ? ('bigtext', ? ? ?'white', ? ? ?'black'),
? ? ? ? ('chars', ? ? ? ?'light gray', 'black'),
? ? ? ? ('exit', ? ? ? ? 'white', ? ? ?'dark cyan'),
? ? ? ? ('bg background','light gray', 'black'),
? ? ? ? ('bg 1', ? ? ? ? 'black', ? ? ?'dark blue', 'standout'),
? ? ? ? ('bg 1 smooth', ?'dark blue', ?'black'),
? ? ? ? ('bg 2', ? ? ? ? 'black', ? ? ?'dark cyan', 'standout'),
? ? ? ? ('bg 2 smooth', ?'dark cyan', ?'black'),
? ? ? ? ] ?

? ? def setup(self):
? ? ? ? self.bigtext = urwid.BigText("sssss", None)

? ? ? ? bt = urwid.Padding(self.bigtext, 'left', None)
? ? ? ? bt = urwid.AttrWrap(bt, 'bigtext')
? ? ? ? bt = urwid.Filler(bt, 'bottom', None, 7)?
? ? ? ? bt = urwid.BoxAdapter(bt, 7)?
? ? ? ? hdr = None
? ? ? ? bt ?= urwid.Frame(header=hdr, body=bt)
? ? ? ? return bt?

? ? def main(self):
? ? ? ? self.view = self.setup()
? ? ? ? self.loop = urwid.MainLoop(self.view, self.palette)
? ? ? ? self.loop.run()

? ? def main():
? ? ? ? Graphics().main()



one at development ~/development/krunch_uploader $ python ../../try/foo.py?

Traceback (most recent call last):
? File "../../try/foo.py", line 77, in <module>
? ? main()
? File "../../try/foo.py", line 74, in main
? ? Graphics().main()
? File "../../try/foo.py", line 70, in main
? ? self.loop.run()
? File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 272, in run
? ? self.screen.run_wrapper(self._run)
? File "/usr/lib64/python2.7/site-packages/urwid/raw_display.py", line 242, in run_wrapper
? ? return fn()
? File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 312, in _run
? ? self.draw_screen()
? File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 563, in draw_screen
? ? canvas = self._topmost_widget.render(self.screen_size, focus=True)
? File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 141, in cached_render
? ? canv = fn(self, size, focus=focus)
? File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1058, in render
? ? focus and self.focus_part == 'body')
? File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 141, in cached_render
? ? canv = fn(self, size, focus=focus)
? File "/usr/lib64/python2.7/site-packages/urwid/decoration.py", line 402, in render
? ? (maxcol,) = size
ValueError: too many values to unpack
one at development ~/development/krunch_uploader $?

If anyone can help, please I would greatly appreciate it.?
Also, I noticed the mailing lists are not emaling to my email(also checked my spam box)...but I am able to check these at?http://lists.excess.org/pipermail/urwid/. Not sure if it should be sending the replies to my email.?

Thanks,
-Darin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20131119/b8280daf/attachment.htm
d hee
2013-11-20 03:51:25 UTC
Permalink
Hi, I've been studying the big text example script. The BigText widget was placed in a pile widget and then recursively placed in a list which would be used by a walker. Can the BigText widget be used as a stand alone without being nested in a Pile widget -> list widget? If yes, can an example please be given?

Thank you,
-Darin



On Tuesday, November 19, 2013 7:09 AM, d hee <coolio at ymail.com> wrote:

Hi,
For experimenting I am trying to make a simple screen with a Title using BigText. But I am getting a render error that I can not figure out in Canvas. Here is my code:
class Graphics():
? ? palette = [
? ? ? ? ('body', ? ? ? ? 'black', ? ? ?'light gray', 'standout'),
? ? ? ? ('header', ? ? ? 'white', ? ? ?'dark red', ? 'bold'),
? ? ? ? ('button normal','light gray', 'dark blue', 'standout'),
? ? ? ? ('button select','white', ? ? ?'dark green'),
? ? ? ? ('button disabled','dark gray','dark blue'),
? ? ? ? ('edit', ? ? ? ? 'light gray', 'dark blue'),
? ? ? ? ('title', ? ? ?'white', ? ? ?'black'),
? ? ? ? ('bigtext', ? ? ?'white', ? ? ?'black'),
? ? ? ? ('chars', ? ? ? ?'light gray', 'black'),
? ? ? ? ('exit', ? ? ? ? 'white', ? ? ?'dark cyan'),
? ? ? ? ('bg background','light gray', 'black'),
? ? ? ? ('bg 1', ? ? ? ? 'black', ? ? ?'dark blue', 'standout'),
? ? ? ? ('bg 1 smooth', ?'dark blue', ?'black'),
? ? ? ? ('bg 2', ? ? ? ? 'black', ? ? ?'dark cyan', 'standout'),
? ? ? ? ('bg 2 smooth', ?'dark cyan', ?'black'),
? ? ? ? ] ?

? ? def setup(self):
? ? ? ? self.bigtext = urwid.BigText("sssss", None)

? ? ? ? bt = urwid.Padding(self.bigtext, 'left', None)
? ? ? ? bt = urwid.AttrWrap(bt, 'bigtext')
? ? ? ? bt = urwid.Filler(bt, 'bottom', None, 7)?
? ? ? ? bt = urwid.BoxAdapter(bt, 7)?
? ? ? ? hdr = None
? ? ? ? bt ?= urwid.Frame(header=hdr, body=bt)
? ? ? ? return bt?

? ? def main(self):
? ? ? ? self.view = self.setup()
? ? ? ? self.loop = urwid.MainLoop(self.view, self.palette)
? ? ? ? self.loop.run()

? ? def main():
? ? ? ? Graphics().main()



one at development ~/development/krunch_uploader $ python ../../try/foo.py?

Traceback (most recent call last):
? File "../../try/foo.py", line 77, in <module>
? ? main()
? File "../../try/foo.py", line 74, in main
? ? Graphics().main()
? File "../../try/foo.py", line 70, in main
? ? self.loop.run()
? File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 272, in run
? ? self.screen.run_wrapper(self._run)
? File "/usr/lib64/python2.7/site-packages/urwid/raw_display.py", line 242, in run_wrapper
? ? return fn()
? File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 312, in _run
? ? self.draw_screen()
? File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 563, in draw_screen
? ? canvas = self._topmost_widget.render(self.screen_size, focus=True)
? File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 141, in cached_render
? ? canv = fn(self, size, focus=focus)
? File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1058, in render
? ? focus and self.focus_part == 'body')
? File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 141, in cached_render
? ? canv = fn(self, size, focus=focus)
? File "/usr/lib64/python2.7/site-packages/urwid/decoration.py", line 402, in render
? ? (maxcol,) = size
ValueError: too many values to unpack
one at development ~/development/krunch_uploader $?

If anyone can help, please I would greatly appreciate it.?
Also, I noticed the mailing lists are not emaling to my email(also checked my spam box)...but I am able to check these at?http://lists.excess.org/pipermail/urwid/. Not sure if it should be sending the replies to my email.?

Thanks,
-Darin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20131119/88a0b30c/attachment.htm
Loading...