MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / get_input_event

Method get_input_event

pager/pagerctl.py:527–549  ·  view source on GitHub ↗

Get next input event from thread-safe queue. This is the preferred method for multi-threaded applications. Each event is only returned once, regardless of which thread reads it. Returns: tuple: (button, event_type, timestamp) or None if queue is empty.

(self)

Source from the content-addressed store, hash-verified

525
526 # Thread-safe input event queue methods
527 def get_input_event(self):
528 """Get next input event from thread-safe queue.
529
530 This is the preferred method for multi-threaded applications.
531 Each event is only returned once, regardless of which thread reads it.
532
533 Returns:
534 tuple: (button, event_type, timestamp) or None if queue is empty.
535 - button: which button (single bit from BTN_* constants)
536 - event_type: PAGER_EVENT_PRESS (1) or PAGER_EVENT_RELEASE (2)
537 - timestamp: when event occurred (ms since init)
538
539 Example:
540 event = pager.get_input_event()
541 if event:
542 button, event_type, timestamp = event
543 if button == Pager.BTN_B and event_type == PAGER_EVENT_PRESS:
544 show_pause_menu()
545 """
546 event = PagerInputEvent()
547 if _lib.pager_get_input_event(byref(event)):
548 return (event.button, event.type, event.timestamp)
549 return None
550
551 def has_input_events(self):
552 """Check if there are pending input events in the queue.

Callers 2

handle_input_loopMethod · 0.45
_wait_buttonMethod · 0.45

Calls 1

PagerInputEventClass · 0.85

Tested by

no test coverage detected