vxgmichel/aioconsole

Is there any way to read one character at the time?

tartavull opened this issue · 1 comments

I want to run a function when the arrow keys are pressed

I really suggest looking into prompt toolkit for this kind of advanced terminal tricks, in particular the following section:

Adding custom key bindings

By default, every prompt already has a set of key bindings which implements the usual Vi or Emacs behaviour. We can extend this by passing another KeyBindings instance to the key_bindings argument of the prompt() function or the PromptSession class.

Note that prompt-toolkit does support asyncio.

Hope that helps!