equal
deleted
inserted
replaced
168 |
168 |
169 Returns: |
169 Returns: |
170 List of Event objects. |
170 List of Event objects. |
171 |
171 |
172 """ |
172 """ |
|
173 res = [] |
|
174 |
173 # Set timeout |
175 # Set timeout |
174 if timeout is None: |
176 if timeout is None: |
175 # wait indefinitely |
177 # wait indefinitely |
176 curses.cbreak() |
178 curses.cbreak() |
177 elif timeout > 0: |
179 elif timeout > 0: |
181 else: |
183 else: |
182 # timeout = 0 -> no wait |
184 # timeout = 0 -> no wait |
183 self.stdscr.nodelay(1) |
185 self.stdscr.nodelay(1) |
184 |
186 |
185 # Get key or char |
187 # Get key or char |
186 c = self.stdscr.get_wch() |
188 try: |
187 |
189 c = self.stdscr.get_wch() |
188 res = [] |
190 except curses.error: |
|
191 # No input in nodelay mode, or timeout |
|
192 return res |
189 |
193 |
190 if c == -1: |
194 if c == -1: |
191 # Timeout |
195 # Timeout |
192 return res |
196 return res |
193 elif c == curses.KEY_MOUSE: |
197 elif c == curses.KEY_MOUSE: |