Nov-29-2021, 08:53 PM
(Nov-29-2021, 04:30 PM)deanhystad Wrote: Next time you post you should post a working example. At least that would show the imports. You should have mentioned that you are using a keyboard package. Maybe this one?
https://pypi.org/project/keyboard/
It seems obvious to me that making enter a hot key is going to break input() which uses enter to signal the end of typing. If you want to use this package you might need to make your own input-like function. The pressed_keys.py example looks like a good start for something like this.
https://github.com/boppreh/keyboard/blob...ed_keys.py
Hello deanhystad, i'm trying to find a solution, but also with hook function,
the problem is always the same.
import keyboard def presentation(): input("Name: ") input("Surname: ") def my_keyboard_hook(keyboard_event): if keyboard_event.name == "enter": print("You have pressed the key: " + keyboard_event.name) presentation() elif keyboard_event.name == "space": print("You have pressed the key: " + keyboard_event.name) keyboard.on_press(my_keyboard_hook) keyboard.wait()Could you check this code and kindly tell me what i'm wrong !? please ...