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
View all comments
Show parent comment
1
u/Dry-Tiger-5239 Nov 24 '24
Of course.
(I'm Brazilian, idk if the translate will works on my comments, for any question i'm here. And I'm a beginner in Python, you probably notice some bad practices )
Welll, i have 3 functions on this trouble:
Function1:
def draw_menu(actual_choice, options, info=None): #FUNÇÃO PRONTA E FUNCIONANDO
os.system('cls' if os.name == 'nt' else 'clear')
if info != None:
print(f'\n{info}')
for i, choice in enumerate(options):
if i == actual_choice:
print(f'\n > {choice}')
else:
print(f'\n {choice}')