[Urwid] Edit Widgets

Rebecca Breu rebecca at rbreu.de
Wed May 24 04:59:14 EDT 2006


Zitat von Ian Ward <ian at excess.org>:

> I wonder if for the SecretEdit class it would be easier to just override
> the get_text() member function like this:
>
> def get_text(self):
> 	return self.caption + "*"*len(self.edit_text), self.attrib
>
> I haven't tried it but it looks like it should work :-)

It does work! Fascinating. :-D That reduces the code a lot.


> .. these are obviously not all for the next release :-)
>

Not if you keep releasing that often. ;-)


On the web page you write that one needs Python 2.1 or higher in order to use
urwid. But when I ran my program with Python 2.2.0, I had to do some slight
modifications to the urwid code:

1.) The curses module doen't recognize window resizing. Thus, cuses.KEY_RESIZE
    doesn't exist. (in curses_display.get_input)

2.) Old Python doesn't like "<string> in <string>", only "<char> in <string>".
    In escape.process_keyqueue (line 257), I changed

    if run[0] == "esc" or "meta " in run[0]:







More information about the Urwid mailing list