is there a way to detect if ENTER is pressed with python? I was able to detect letters with win32api using win32api.GetAsyncKeyState(ord('H'))
, but couldn't do the same with enter. I need to run the code on windows. Thanks.
You can use keyboard lib.
pip3 install keyboard
import keyboard
if keyboard.read_key() == "enter":
...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.