Is there any way to read one character at the time?
tartavull opened this issue · 1 comments
tartavull commented
I want to run a function when the arrow keys are pressed
vxgmichel commented
I really suggest looking into prompt toolkit for this kind of advanced terminal tricks, in particular the following section:
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!