Python wait for input
15 Python code examples are found related to "
wait for input".
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: interpreter.py From Chatette with MIT License | 6 votes |
def wait_for_input(self): """ Waits for the user to type a command, interprets it and executes it. """ if self._dont_enter_interactive_mode: return stop = False while True: print(">>> ", end='') try: command_str = input() except EOFError: print("Exiting interactive mode") break stop = self.interpret_command(command_str) if stop: print("Exiting interactive mode") break
Example 2
Source File: pipeline_step.py From idseq-dag with MIT License | 6 votes |
def wait_for_input_files(self): ''' wait for all the input files to be available and update input_files_local ''' for fl in self.input_files: flist = [] for f in fl: if f in self._files_seen: raise InvalidInputFileError({ "error": "Filename conflict: {} already exists in {}".format(f, self._files_seen), "step": self.name }) else: self._files_seen.add(f) local_file = os.path.join(self.output_dir_local, f) while True: if os.path.exists(local_file) and os.path.exists(self.done_file(local_file)): flist.append(local_file) break else: if self.should_terminate: # If the step is not supposed to be run any more. raise RuntimeError("Step %s being terminated" % self.name) time.sleep(5) self.input_files_local.append(flist)
Example 3
Source File: screen.py From asciimatics with Apache License 2.0 | 5 votes |
def wait_for_input(self, timeout): """ Wait until there is some input or the timeout is hit. :param timeout: Time to wait for input in seconds (floating point). """
Example 4
Source File: user32.py From PyDev.Debugger with Eclipse Public License 1.0 | 5 votes |
def WaitForInputIdle(hProcess, dwMilliseconds = INFINITE): _WaitForInputIdle = windll.user32.WaitForInputIdle _WaitForInputIdle.argtypes = [HANDLE, DWORD] _WaitForInputIdle.restype = DWORD r = _WaitForInputIdle(hProcess, dwMilliseconds) if r == WAIT_FAILED: raise ctypes.WinError() return r # UINT RegisterWindowMessage( # LPCTSTR lpString # );
Example 5
Source File: resource_tools.py From aws-media-services-simple-live-workflow with Apache License 2.0 | 5 votes |
def wait_for_input_states(medialive, input_id, states): current_state = '' while current_state not in states: time.sleep(5) current_state = medialive.describe_input(InputId=input_id)['State'] return current_state
Example 6
Source File: rofi-calibration.py From pyrobotlab with Apache License 2.0 | 5 votes |
def waitForInput(): print "Press the C key to continue\n" speech.speak("Press the C key in the keyboard panel to continue") keypress = keyboard.readKey() while keypress != 'C': #loop until space keypress = keyboard.readKey()
Example 7
Source File: atvscript.py From pyatv with MIT License | 5 votes |
def wait_for_input(loop, abort_sem): """Wait for user input (enter) or abort signal.""" reader = asyncio.StreamReader(loop=loop) reader_protocol = asyncio.StreamReaderProtocol(reader) await loop.connect_read_pipe(lambda: reader_protocol, sys.stdin) await asyncio.wait( [reader.readline(), abort_sem.acquire()], return_when=asyncio.FIRST_COMPLETED )
Example 8
Source File: _tutorial.py From explorer-hat with MIT License | 5 votes |
def wait_for_input(string): prompt() while True: if string == get_input(): return True else: type_write(colorama.Fore.RESET + "Whoops! That isn't quite right. Try again!") prompt()
Example 9
Source File: smartconsole.py From iOSSecAudit with GNU General Public License v3.0 | 5 votes |
def wait_for_input(self): """""" line = raw_input(G.prompt) encoding = getattr(sys.stdin, "encoding", None) if encoding and not isinstance(line, unicode): line = line.decode(encoding) return line
Example 10
Source File: alert.py From PyPlanet with GNU General Public License v3.0 | 5 votes |
def wait_for_input(self): # pragma: no cover """ Wait for input and return it. :return: Returns the string value of the user. """ return await self.response_future
Example 11
Source File: main-punput-2.py From python-examples with MIT License | 5 votes |
def wait_for_user_input(): listener = keyboard.Listener(on_press=on_press, on_release=on_release) listener.start() listener.join() # wait till listener stops if key_pressed == 'c': # do something elif key_pressed == "v": # do something else elif key_pressed == keyboard.Key.esc: print('You pressed ESC')
Example 12
Source File: SendKeys.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def WaitForInputProcessed(self): if self.procHandle: WaitForInputIdle(self.procHandle, 100) def DoIt(): SetTimer(self.dummyHwnd, 1, 0, None) self.msg.message = 0 while self.msg.message != WM_TIMER: GetMessage(byref(self.msg), self.dummyHwnd, 0, 0) eg.CallWait(DoIt)