cv3.io.wait_key
- cv3.io.wait_key(t)[source]
Wait for a keyboard event.
- Parameters:
t (int) – Delay in milliseconds. If 0, it waits indefinitely for a key stroke.
- Returns:
The code of the pressed key, or -1 if no key was pressed before the timeout.
- Return type:
int
Note
This function is a wrapper around cv2.waitKey() that masks the return value with 0xFF to ensure consistent behavior across different platforms.
Example
>>> import cv3 >>> # Wait for a key press for 1 second >>> key = cv3.wait_key(1000) >>> if key != -1: ... print(f'Key pressed: {key}')