rustyhowell
2017-06-16 19:11:21 UTC
I'm trying to understand how containers work in the overall layout of the
widgets. I have a simple example where I want two columns of widgets at the
top of the screen, and then a single column of widgets at the beneath that.
import urwid
cols = urwid.Columns([urwid.Text('Column1'), urwid.Text('Column2')])
pile = urwid.Pile([cols, urwid.Text("Merged Column")])
loop = urwid.MainLoop(pile)
loop.run()
The code above crashes with the stack trace below. I'm not sure what to
make of the error. What is the correct way to do what I'm wanting?
Traceback (most recent call last):
File "./testapp.py", line 8, in <module>
loop.run()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 278, in run
self._run()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 376, in _run
self.event_loop.run()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 682, in run
self._loop()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 710, in _loop
self._entering_idle()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 671, in _entering_idle
callback()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 564, in entering_idle
self.draw_screen()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 578, in draw_screen
canvas = self._topmost_widget.render(self.screen_size, focus=True)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/widget.py",
line 141, in cached_render
canv = fn(self, size, focus=focus)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/container.py",
line 1526, in render
canv = w.render((maxcol, rows), focus=focus and item_focus)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/widget.py",
line 141, in cached_render
canv = fn(self, size, focus=focus)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/container.py",
line 2085, in render
focus = focus and self.focus_position == i)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/widget.py",
line 141, in cached_render
canv = fn(self, size, focus=focus)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/widget.py",
line 1003, in render
(maxcol,) = size
ValueError: too many values to unpack (expected 1)
widgets. I have a simple example where I want two columns of widgets at the
top of the screen, and then a single column of widgets at the beneath that.
import urwid
cols = urwid.Columns([urwid.Text('Column1'), urwid.Text('Column2')])
pile = urwid.Pile([cols, urwid.Text("Merged Column")])
loop = urwid.MainLoop(pile)
loop.run()
The code above crashes with the stack trace below. I'm not sure what to
make of the error. What is the correct way to do what I'm wanting?
Traceback (most recent call last):
File "./testapp.py", line 8, in <module>
loop.run()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 278, in run
self._run()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 376, in _run
self.event_loop.run()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 682, in run
self._loop()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 710, in _loop
self._entering_idle()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 671, in _entering_idle
callback()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 564, in entering_idle
self.draw_screen()
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/main_loop.py",
line 578, in draw_screen
canvas = self._topmost_widget.render(self.screen_size, focus=True)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/widget.py",
line 141, in cached_render
canv = fn(self, size, focus=focus)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/container.py",
line 1526, in render
canv = w.render((maxcol, rows), focus=focus and item_focus)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/widget.py",
line 141, in cached_render
canv = fn(self, size, focus=focus)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/container.py",
line 2085, in render
focus = focus and self.focus_position == i)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/widget.py",
line 141, in cached_render
canv = fn(self, size, focus=focus)
File
"/home/rhowell/python3_venv/lib/python3.5/site-packages/urwid/widget.py",
line 1003, in render
(maxcol,) = size
ValueError: too many values to unpack (expected 1)
--
You received this message because you are subscribed to the Google Groups "Urwid Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urwid+***@excess.org.
To post to this group, send email to ***@excess.org.
For more options, visit https://groups.google.com/a/excess.org/d/optout.
You received this message because you are subscribed to the Google Groups "Urwid Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urwid+***@excess.org.
To post to this group, send email to ***@excess.org.
For more options, visit https://groups.google.com/a/excess.org/d/optout.