Collect all events from the internal queue and clear the queue.
(self)
| 300 | self.hook = hook |
| 301 | |
| 302 | def collect_events(self): |
| 303 | """Collect all events from the internal queue and clear the queue.""" |
| 304 | result = [] |
| 305 | while True: |
| 306 | try: |
| 307 | e = self._events.get(block=False) |
| 308 | result.append(e) |
| 309 | except queue.Empty: |
| 310 | return result |
| 311 | |
| 312 | def wait_for_event(self, timeout, name=None): |
| 313 | """Wait for and return next event.""" |