curses event handling

Walter Dörwald walter at livinglogic.de
Wed Jun 7 12:04:58 EDT 2006


John Hunter wrote:
> I have a curses app that is displaying real time data.  I would like
> to bind certain keys to certain functions, but do not want to block
> waiting for 
>  
>   c = screen.getch() 
> 
> Is it possible to register callbacks with curses, something like
> 
>   screen.register('keypress', myfunc)

You could use curses.halfdelay(), so that screen.getch() doesn't block
indefinitely. I'm not sure if this will be fast enough for your application.

Servus,
   Walter



More information about the Python-list mailing list