[Urwid][Fwd: Find focused Edit]

cantabile cantabile.03 at wanadoo.fr
Sat Jul 30 12:03:21 EDT 2005

Ian Ward a écrit :

> Your code looks ok.  In your run loop are you updating the help text 
> after the keypress and before drawing? If you update the help text 
> before the next keypress and after drawing then the former widget's 
> help text will still be displayed instead of the current one.
> Ian
Thanks for the reply. Here's my 'run' code.

  def run(self):
        size = self.ui.get_cols_rows()
        while 1:
            canvas = self.view.render( size, focus=1)
            self.ui.draw_screen(size, canvas)
            keys= None
            while not keys:
                keys= self.ui.get_input()
                for k in keys:
                    if k == 'window resize':
                        size = self.ui.get_cols_rows()
                    elif k == 'f5':
                    elif k== 'f8':
                        w, pos = self.listbox.get_focus()
                        while hasattr(w, 'get_focus'):
                            w = w.get_focus()
                            if w.__class__.__name__ == 'It':
            self.view.keypress(size, k)

I tried to write 'self.ui.draw_screen(size, canvas)' just before the 
last line, but the screen is black when I launch the app. for the first 
time. I must have misunderstood something in what you said.

Where should I draw the screen ?

PS : I'm out tonight. I'll answer back tomorrow.

More information about the Urwid mailing list