[Urwid] Urwid on Win32

Gottfried Ganßauge ganssauge at gmx.de
Thu Aug 24 16:37:19 EDT 2006

Ian Ward schrieb:
> I've CC'd this message to the pdcurses list as well.
> Gottfried Ganßauge wrote:
>> Being interested in the hachoir file dissector (http://www.hachoir.org)
>> I managed to compile a _curses-Module under Windows using pdcurses
>> (http://pdcurses.sourceforge.net/).
>> This started running quite fine but didn't accept any special keys and
>> additionally didn't recognize Enter.
>> Please consider the attached patch against urwid-0.9.6 for rectifying
>> this behaviour.
> ...
>> -            self.s.keypad(0)
>> +            self.s.keypad(hasattr (sys, "getwindowsversion"))
> The ncurses library will do extra processing of the user input when
> keypad is set.  I disabled this behaviour because ncurses will hold on
> to incomplete escape sequences (such as just the ESC key) for up to 1
> second before returning them.
I've seen the message to that effect in the mailing list.
Being a vi user on unix myself I'm quite used to that - not to say I'm
expecting this behaviour :-)

> Since it seems that the only way to get special characters from pdcurses
> is with keypad set, I would prefer something like:
>     self.s.keypad(is_running_under_pdcurses)
Yes, I can see what want.
Unfortunately I don't know any way to check for the curses
implementation used by the python _curses module :-(

>> -    def set_input_timeouts(self, max_wait=0.5, complete_wait=0.1,
>> +    def set_input_timeouts(self, max_wait=0.1, complete_wait=0.1,
>>          resize_wait=0.1):
> The proper way to change the input timeouts for your application is to
> call this function from your application. eg:
>     urwid.set_input_timeouts(max_wait=0.1)
Actually this was more kind of a proposal - I can't imagine anyone to
wait 0.5s for a key when trying to accomplish something on the screen.

>> -
>> +if os.name == 'nt':     # Windows
>> +    _keyconv [13] = 'enter'
> I wonder why pdcurses doesn't send LF on enter?  That must cause
> problems with other curses applications!
There aren't many on windows :-) and I guess those expect CR for the
enter key.

> Ian


More information about the Urwid mailing list