| 58 | |
| 59 | |
| 60 | class EventLoopRunner(object): |
| 61 | |
| 62 | def Run(self, time, input_is_ready): |
| 63 | self.input_is_ready = input_is_ready |
| 64 | self.evtloop = wx.EventLoop() |
| 65 | self.timer = EventLoopTimer(self.check_stdin) |
| 66 | self.timer.Start(time) |
| 67 | self.evtloop.Run() |
| 68 | |
| 69 | def check_stdin(self): |
| 70 | if self.input_is_ready(): |
| 71 | self.timer.Stop() |
| 72 | self.evtloop.Exit() |
| 73 | |
| 74 | |
| 75 | @ignore_keyboardinterrupts |