Reputation: 65
Python's input() method prompts the user to enter a string in the terminal. They submit the string with ENTER key.
I would like to overwrite the input() method and replace the key from ENTER to SPACEBAR.
How do I do that?
Thank you
Upvotes: 1
Views: 658
Reputation: 137
Unfortunately, I don't believe this is achievable in vanilla python, however you could try using the curses library to disable input buffering (waiting for ENTER) and read input character by character. After doing this, you could easily implement a spacebar submission system via reading characters into a string and, when SPACEBAR is pressed, registering that string to a central location.
Upvotes: 1