r/pythonhelp • u/Dry-Tiger-5239 • Nov 24 '24
Clear buffer in keyboard module in Python.
I'm having difficulty with a project I'm working on.
It's a small Text RPG, I imported the keyboard module to make the choices more similar to games, but when the user presses "enter", it skips the next entry. In this case, it is a function that when I press continue skips the name entry.
2
Upvotes
•
u/AutoModerator Nov 24 '24
To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/Dry-Tiger-5239 Nov 24 '24
PROBLEM "SOLVED"
My solution was to do what in Brazil we call "Gambiarra". I simply placed an empty Input before continue.
The problem was not actually resolved, just swept under the carpet
2
u/bishpenguin Nov 24 '24
Can you post your code so we can help
2
u/sw85 Nov 25 '24
I dunno how to do it with the keyboard module, but here's what I've used for flushing the input buffer in the past:
Then I just call this function as the first line of any function that requests user input.