[Urwid] Urwid on Win32

Ian Ward ian at excess.org
Thu Aug 24 09:04:00 EDT 2006

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.

Since it seems that the only way to get special characters from pdcurses 
is with keypad set, I would prefer something like:


> -	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:


> -
> +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!


More information about the Urwid mailing list