OS: Windows 11
Python Version: 3.9
I was playing around with pyautogui
module with the below code.
import pyautogui
from time import time
start = time()
print(start)
while True:
current = time()
if current - start >= 5:
break
pyautogui.press('right')
print(current)
Description of the above code:
Press the right arrow key for 5 seconds without any delay.
Observation
It presses right arrow key for 5 seconds and exits.
But even after it exits, right arrow key is being pressed for quite some time. So my guess is, windows is not fast enough to process the right arrow key press at which speed python is running the command. Hence it's keeping the key presses in a queue/ buffer and processes them until the buffer is cleared, even after the program is exited a while back.
Is there a way to see, from python, whether that windows key input buffer is empty or not?