[Urwid] BigText- Missing Object to Render for main loop

d hee coolio at ymail.com
Sun Nov 17 23:27:12 EST 2013


Hi,

I  am new and trying to learn urwid. For experimenting, I want to simply make a screen with the Title on top using urwid.BigText().

In my code:

class Graphics():    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)

    def main(self):

        self.view = self.setup()
        self.loop = urwid.MainLoop(self.view, self.palette)
        self.loop.run()


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

if '__main__'==__name__:
    main()

This causes an error:
one at development ~/try $ python foo.py 

Traceback (most recent call last):
  File "foo.py", line 77, in <module>
    main()
  File "foo.py", line 74, in main
    Graphics().main()
  File "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)
AttributeError: 'NoneType' object has no attribute 'render'
one at development ~/try $ 

It seems that it's missing the urwid object to render. But I sent it successfully to the main loop. Can anyone please help?

Thanks,
-Darin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20131117/c57583f8/attachment.htm 


More information about the Urwid mailing list