I am using read_loop() from python-evdev to capture the codes from an ir remote control.
#!/usr/bin/env python3
from evdev import InputDevice
dev = InputDevice('/dev/input/event0')
for event in dev.read_loop():
print(event.value)
How can I break out of the loop when the codes from a button are received and the button no longer is pressed?