[Urwid] ListBox, focus and colors

Ian Ward ian at excess.org
Fri Apr 28 19:52:27 EDT 2006


Bernardo Torres wrote:
> I used this and played with keypress, but got weird results. Using
> solely the example doesn't seem to work. I made a mini example to test
> it (attached).
...
>   def main(self):
>     self.size = self.ui.get_cols_rows()
>     while True:
>       self.canvas = self.box.render(self.size)
change to:
         self.canvas = self.box.render(self.size, focus=True)

>       self.ui.draw_screen(self.size, self.canvas)
>       keys = None
>       while not keys:
>         keys = self.ui.get_input()
>       for k in keys:
>         if "q" in k or "Q" in k:
>           break
>         elif "window resize" in k:
>           cols, rows = self.ui.get_cols_rows()
change to:
             self.size = self.ui.get_cols_rows()
(or resizing the screen won't work)

>         self.box.keypress(self.size, k)
> i = Interface()
> 

Ian




More information about the Urwid mailing list