1

I wanted to know if there is a way to tell python to run a function as long as we are typing new characters as a user input.

for example when I write hello, I want it to run a function simultaneously as I type each character! without me having to hit space and enter every time!

is there a method for that I can use ?

Dela
  • 55
  • 5

1 Answers1

0

The getch package provides this functionality. You can install it with:

pip install getch

And a basic usage example is like this:

from getch import getch

while True: 
    c = getch() 
    print("got", c)
platypus
  • 700
  • 6
  • 9